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.
What can you do to show the current branch? First, click File option in top tool bar then go to Preferences then 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
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.
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.
Your final selection should be like this.
Now, close your Terminal window and open new one again. cd inside a git clone directory and it should now show your current branch.