123onetwothree
123onetwothree

Reputation: 686

Show git branch in Visual Studio Code

I have a project folder structure like this : Code/Repo/<repo_folder_name>/..subfolders and in the <repo_folder_name> i have the hidden .git folder because i cloned from Sourcetree to this folder .

Eclipse does show the current branch , but when i open this folder in Visual Studio Code , i know it must show the current branch name , in the bottom left side .

Does anybody know how to do this ? To show the branch name in Visual Studio Code ?

Thank you very much.

-- > I added Sourcetree`s bin folder to the PATH and now everything is working ok :D . Sourcetree uses embed git so you have to add it to the window path

Upvotes: 22

Views: 135566

Answers (7)

Maros
Maros

Reputation: 45

In my setup I right-clicked on git part of status Bar and selected "Source Control Checkout" see screenshot below:

enter image description here

Upvotes: 1

Ed of the Mountain
Ed of the Mountain

Reputation: 5459

In year 2022

  1. From top menu, select and check View > Appearance > Status bar
  2. Status bar appears at bottom of VS Code Window
  3. Branch displays in Status bar on left-side

Upvotes: 7

Adam Smooch
Adam Smooch

Reputation: 1322

It's not clear if you're looking for display on the command-line [prompt] or in the VSCode UI.

There's this alternative view provided by the sidebar plugin that fits the bill when the Source Control Repositories option is checked (right-click on the topmost Source Control header): enter image description here

UI branch controls! enter image description here

Upvotes: 2

ttfreeman
ttfreeman

Reputation: 5533

For windows: The easiest thing would be to change your integrated terminal shell from Powershell to Git Bash. You can do that by going to File > Preferences > Setting and changing the integrated terminal shell, as illustrated below:

enter image description here

For mac navigate to: Code> Preferences> settings> Search for 'terminal'

Upvotes: 14

P. Ntende
P. Ntende

Reputation: 11

If you would also like to show the working branch in the Visual code Terminal Window, Try installing posh-git from chocolatey, you get all the git summarycolor codings and tab completion with the branch name in highlighted colors. If you are running a Powershell version less than 6, make sure to set execution policies above Restricted.

Upvotes: 0

jox
jox

Reputation: 2368

In the docs it says:

Note: VS Code will leverage your machine's Git installation, so you need to install Git first before you get these features. Make sure you install at least version 2.0.0.

So there needs to be a Git on your system to get it working. Using the embedded Git from your Sourcetree installation will probably work, but might not be the cleanest solution. The Git in my Sourcetree installation (on a Mac) is about 3 years old (2.2.1). On a Mac there is also a Git preinstalled though (2.11.0), so here it works out of the box.

Upvotes: 4

Marc
Marc

Reputation: 5508

Assuming you have git installed all you do is go to View->Show Status Bar (as seen below). It will then show your current branch on the bottom of your current editor window.

Menu Being Selected

Upvotes: 25

Related Questions