
Here I'm comparing the local with the remote my-branch. Now you can compare any two branches from all the available ones (you can also compare two locals or two remotes). # Better: the pattern includes the remote You can also combine -list with the options -a and -r, but make sure to adapt your pattern accordingly ( remember: remote branches start with "remotes").Įxample: # This will show all branches (local & remote) that start with my Use it with a pattern like this: $ git branch -list 'my*' To complete a review of the basic branch options, there's the -list that, contrary to what you might expect, is there to allow filtering.

To show local branches use git branch with no options $ git branch To show just local branches you might be tempted to use git branch -l, but that's a completely different command. If you just want to show remote branches: $ git branch -r # (or git branch -remotes) Note: the remote branches in the Git Bash shell are shown in red while the local ones are shown in green. Here I have two local branches ( my-branch and master) and four remote branches ( some-branch, some-other-branch, master, and my-branch).Īlso, the asterisk next to my-branch signals the fact that I'm currently in that branch (you would also know that by using the command git status that would output: On branch my-branch.).

Here's a command to show all branches $ git branch -a # (or git branch -all) When using Git in the shell, I like to first orient myself by looking around.
