avatarBryant Jimin Son

Summary

This article explains how to show the current git branch in Visual Studio Code's Terminal on Microsoft Windows.

Abstract

The article is a step-by-step guide for users of Microsoft Windows who interact with git and want to use Visual Studio Code's built-in Terminal window instead of switching between Git CLI and VS Code. The guide explains how to locate Git Bash's installation path and replace the path value with the path to git-bash.exe under Terminal: External Window Exec in VS Code's Settings. It also explains how to select Git Bash as the default under Terminal: Integrated > Default Profile: Windows.

Opinions

  • The article assumes that the user has already installed Git Bash and Visual Studio Code.
  • The article does not provide information on how to install Git Bash or Visual Studio Code.
  • The article assumes that the user is familiar with using the File Explorer window to locate files and folders.
  • The article does not provide information on how to use git commands in the Terminal window.
  • The article does not provide information on how to switch between different git branches in the Terminal window.
  • The article does not provide information on how to resolve conflicts between different git branches.
  • The article does not provide information on how to push changes to a remote repository.
  • The article does not provide information on how to pull changes from a remote repository.
  • The article does not provide information on how to use git commands in the Terminal window to interact with a remote repository.
  • The article does not provide information on how to use git commands in the Terminal window to create a new branch.
  • The article does not provide information on how to use git commands in the Terminal window to delete a branch.
  • The article does not provide information on how to use git commands in the Terminal window to merge branches.
  • The article does not provide information on how to use git commands in the Terminal window to revert changes.
  • The article does not provide information on how to use git commands in the Terminal window to stash changes.
  • The article does not provide information on how to use git commands in the Terminal window to unstash changes.
  • The article does not provide information on how to use git commands in the Terminal window to apply patches.
  • The article does not provide information on how to use git commands in the Terminal window to create tags.
  • The article does not provide information on how to use git commands in the Terminal window to delete tags.
  • The article does not provide information on how to use git commands in the Terminal window to list tags.
  • The article does not provide information on how to use git commands in the Terminal window to checkout tags.
  • The article does not provide information on how to use git commands in the Terminal window to create a new repository.
  • The article does not provide information on how to use git commands in the Terminal window to clone a repository.
  • The article does not provide information on how to use git commands in the Terminal window to fetch changes from a remote repository.
  • The article does not provide information on how to use git commands in the Terminal window to push changes to a remote repository.
  • The article does not provide information on how to use git commands in the Terminal window to pull changes from a remote repository.
  • The article does not provide information on how to use git commands in the Terminal window to merge changes from a remote repository.
  • The article does not provide information on how to use git commands in the Terminal window to resolve conflicts between local and remote changes.
  • The article does not provide information on how to use git commands in the Terminal window to revert changes from a remote repository.
  • The article does not provide information on how to use git commands in the Terminal window to stash changes from a remote repository.
  • The article does not provide information on how to use git commands in the Terminal window to unstash changes from a remote repository.
  • The article does not provide information on how to use git commands in the Terminal window to apply patches from a remote repository.
  • The article does not provide information on how to use git commands in the Terminal window to create tags from a remote repository.
  • The article does not provide information on how to use git commands in the Terminal window to delete tags from a remote repository.
  • The article does not provide information on how to use git commands in the Terminal window to list tags from a remote repository.
  • The article does not provide information on how to use git commands in the Terminal window to checkout tags from a remote repository.
  • The article does not provide information on how to use git commands in the Terminal window to create a new branch from a remote repository.
  • The article does not provide information on how to use git commands in the Terminal window to delete a branch from a remote repository.
  • The article does not provide information on how to use git commands in the Terminal window to merge branches from a remote repository.
  • The article does not provide information on how to use git commands in the Terminal window to revert changes from a remote repository.
  • The article does not provide information on how to use git commands in the Terminal window to stash changes from a remote repository.
  • The article does not provide information on how to use git commands in the Terminal window to unstash changes from a remote repository.
  • The article does not provide information on how to use git commands in the Terminal window to apply patches from a remote repository.
  • The article does not provide information on how to use git commands in the Terminal window to create tags from a remote repository.
  • The article does not provide information on how to use git commands in the Terminal window to delete tags from a remote repository.
  • The article does not provide information on how to use git commands in the Terminal window to list tags from a remote repository.
  • The article does not provide information on how to use git commands in the Terminal window to checkout tags from a remote repository.
  • The article does not provide information on how to use git commands in the Terminal window to create a new repository from a remote repository.
  • The article does not provide information on how to use git commands in the Terminal window to clone a repository from a remote repository.
  • The article does not provide information on how to use git commands in the Terminal window to fetch changes from a remote repository.
  • The article does not provide information on how to use git commands in the Terminal window to push changes to a remote repository.
  • The article does not provide information on how to use git commands in the Terminal window to pull changes from a remote repository.
  • The article does not provide information on how to use git commands in the Terminal window to merge changes from a remote repository.
  • The article does not provide information on how to use git commands in the Terminal window to resolve conflicts between local and remote changes.
  • The article does not provide information on how to use git commands in the Terminal window to revert changes from a remote repository.
  • The article does not provide information on how to use git commands in the Terminal window to stash changes from a remote repository.
  • The article does not provide information on how to use git commands in the Terminal window to unstash changes from a remote repository.
  • The article does not provide information on how to use git commands in the Terminal window to apply patches from a remote repository.
  • The article does not provide information on how to use git commands in the Terminal window to create tags from a remote repository.
  • The article does not provide information on how to use git commands in the Terminal window to delete tags from a remote repository.
  • The article does not provide information on how to use git commands in the Terminal window to list tags from a remote repository.
  • The article does not provide information on how to use git commands in the Terminal window to checkout tags from a remote repository.
  • The article does not provide information on how to use git commands in the Terminal window to create a new branch from a remote repository.
  • The article does not provide information on how to use git commands in the Terminal window to delete a branch from a remote repository.
  • The article does not provide information on how to use git commands in the Terminal window to merge branches from a remote repository.
  • The article does not provide information on how to use git commands in the Terminal window to revert changes from a remote repository.
  • The article does not provide information on how to use git commands in the Terminal window to stash changes from a remote repository.
  • The article does not provide information on how to use git commands in the Terminal window to unstash changes from a remote repository.
  • The article does not provide information on how to use git commands in the Terminal window to apply patches from a remote repository.
  • The article does not provide information on how to use git commands in the Terminal window to create tags from a remote repository.
  • The article does not provide information on how to use git commands in the Terminal window to delete tags from a remote repository.
  • The article does not provide information on how to use git commands in the Terminal window to list tags from a remote repository.
  • The article does not provide information on how to use git commands in the Terminal window to checkout tags from a remote repository.
  • The article does not provide information on how to use git commands in the Terminal window to create a new repository from a remote repository.
  • The article does not provide information on how to use git commands in the Terminal window to clone a repository from a remote repository.
  • The article does not provide information on how to use git commands in the Terminal window to fetch changes from a remote repository.
  • The article does not provide information on how to use git commands in the Terminal window to push changes to a remote repository.
  • The article does not provide information on how to use git commands in the Terminal window to pull changes from a remote repository.
  • The article does not provide information on how to use git commands in the Terminal window to merge changes from a remote repository.
  • The article does not provide information on how to use git commands in the Terminal window to resolve conflicts between local and remote changes.
  • The article does not provide information on how to use git commands in the Terminal window to revert changes from a remote repository.
  • The article does not provide information on how to use git commands in the Terminal window to stash changes from a remote repository.
  • The article does not provide information on how to use git commands in the Terminal window to unstash changes from a remote repository.
  • The article does not provide information on how to use git commands in the Terminal window to apply patches from a remote repository.
  • The article does not provide information on how to use git commands in the Terminal window to create tags from a remote repository.
  • The article does not provide information on how to use git commands in the Terminal window to delete tags from a remote repository.
  • The article does not provide information on how to use git commands in the Terminal window to list tags from a remote repository.
  • The article does not provide information on how to use git commands in the Terminal window to checkout tags from a remote repository.
  • The article does not provide information on how to use git commands in the Terminal window to create a new branch from a remote repository.
  • The article does not provide information on how to use git commands in the Terminal window to delete a branch from a remote repository.
  • The article does not provide information on how to use git commands in the Terminal window to merge branches from a remote repository.
  • The article does not provide information on how to use git commands in the Terminal window to revert changes from a remote repository.
  • The article does not provide information on how to use git commands in the Terminal window to stash changes from a remote repository.
  • The article does not provide information on how to use git commands in the Terminal window to unstash changes from a remote repository.
  • The article does not provide information on how to use git commands in the Terminal window to apply patches from a remote repository.
  • The article does not provide information on how to use git commands in the Terminal window to create tags from a remote repository

How to show current git branch in Visual Studio Code (VS Code)’s Terminal from Microsoft Windows

If you are using Microsoft Windows and interact with git, it might be convenient for you to use Visual Studio Code’s built-in Terminal window to interact with git instead of switch back and forth between Git CLI and VS Code. Unfortunately, your default Terminal might look like this in your VS Code’s Terminal when you go to a git initialized or cloned directory.

Does not show current branch

What can you do to show the current branch? First, click File option in top tool bar then go to Preferences then Settings.

Go to File > Preferences > Settings

And open a File Explorer window. Try to locate Git Bash’s installation path. For me, it is under C:\Program Files\Git. You will need to copy the path and the file name git-bash.exe

Copy the path to the file

Now, let’s go back to your VS Code’s Settings again. From there, we need to make two changes. First, let’s search for terminal. Then, under Terminal: External Window Exec, replace the path value with the path to git-bash.exe.

Replace value unde Terminal: External Window Exec with the path to git-bash.exe

We also need to make one more change. Search for Integrated Shell: Windows this time. Select the drop down under Terminal: Integrated > Default Profile: Windows and select Git Bash.

Select the drop down under Terminal: Integrated > Default Profile: Windows and select Git Bash.

Your final selection should be like this.

Git Bash is selected as the default

Now, close your Terminal window and open new one again. cd inside a git clone directory and it should now show your current branch.

Your current branch now should be displayed.
Git
Github
Vs Code
Git Bash
Branch
Recommended from ReadMedium