Use Git with Visual Studio Code

How-To Use Git with Visual Studio Code

If people around you have been asking you to get Git, especially in a professional setting, you need to get your hands on Git.

Firstly, if you are unaware of the concept of Git or GitHub, I recommend you read the following article to become well-versed on this platform: linktoGitForWindows.

Git is a distributed version control system and allows a unique method to collaborate with your team members while development.

Apart from Git, there exist several other VCS that can be discovered like Subversion (SVN), Mercurial, Perforce, or IBM Rational ClearCase.

These are just a few examples, and there are other VCS options available as well. The choice of VCS depends on factors such as the nature of the project, team size, collaboration requirements, and personal preferences. Git has gained significant popularity due to its distributed nature, scalability, and robust community support, but other VCS options still find use in specific scenarios.

The above article discusses in detail using Git using your terminal or command prompt. But over time there have been several alternatives that make this whole process much easier. So instead of writing down commands, you are just one click away from performing these commands.

Let me pose a small question in front of you. Would you rather download the application of Facebook on your mobile phone, or use it on your phone’s browser? For several reasons picking up the option of application seems like a much more viable option. Ease of use, user friendly, the user interface and experience, all are much better on the application that takes a special place in your phone, compared to the browser experience.

Similarly, GitHub has its GitHub desktop, which was built with the idea of making the whole experience of Git better.

GitHub Desktop

GitHub Desktop is a graphical user interface (GUI) application that provides a more accessible and user-friendly way to interact with Git and GitHub. It simplifies common Git operations and provides a visual interface for managing repositories and collaborating. Here are some critical uses of GitHub Desktop:

  • Repository management: GitHub Desktop allows you to create new repositories, clone existing repositories from GitHub or other sources, and manage your local repositories effortlessly.
  • Committing changes: With GitHub Desktop, you can easily stage and save changes to your local repository. It provides a visual diff tool that helps you review and select specific changes to include in each commit.
  • Branching and merging: GitHub Desktop simplifies creating and switching between branches. You can perform branch operations with a few clicks, reducing the need for command-line commands.
  • Synchronization with GitHub: GitHub Desktop integrates seamlessly with GitHub, allowing you to push your local commits to your GitHub repositories and pull changes from remote repositories. It provides a user-friendly interface to sync your local repository with the corresponding GitHub repository, making it easier to collaborate with others and keep your local and remote repositories up to date.
  • Collaboration features: GitHub Desktop streamlines collaboration by providing features like pull requests and branch comparisons
  • Visualizing history and changes: GitHub Desktop offers an intuitive way to explore your repository’s commit history. This makes it easier to understand the project’s evolution and track specific changes.

Overall, GitHub Desktop is a user-friendly interface for working with Git and GitHub, abstracting away some of the complexities of command-line interactions. It benefits developers who prefer a visual workflow or are new to version control systems.

Visual Studio Code

A common method used by developers is to add the functionalities of Git to your IDE. VS code is one of the most popular IDE for this use due to its ease of integration.

The integration process of GitHub desktop and VS code is quite simple.

Install and set up the GitHub desktop on your device.

  • Next, make sure you have downloaded VS code, download it using the link: Visual Studio Code – Code Editing
  • After the successful setup of both these required applications, open VS code and launch it on your device.
  • Now you will have to install the GitHub pull request and issues extension. Use the sidebar to click on the extensions, or press Ctrl+Shift+X, search for “GitHub Pull Requests and Issues,” and click on the “Install” button to add the extension to VS Code.
  • Next, set up your GitHub desktop as the Git provider on your VS code, use the command palette by pressing Ctrl+Shift+P (or Cmd+Shift+P on macOS). Type “Git: Select Default Repository Provider” and select “GitHub Desktop” from the list.
  • Connect VS Code to GitHub Desktop: Open the Command Palette again and type “GitHub: Open Repository in GitHub Desktop.” Select a repository from the list or choose “Add Custom Repository” to provide the repository URL manually. This will open the selected repository in GitHub Desktop.

  • And now you can start working on your repository using GitHub desktop or VS code. You can now easily make commits, pull and push from the URL added.

These steps will allow you to now combine VS code with GitHub desktop, so you can keep making changes on your repository while you keep writing your code. Breaking no workflow.