📝 Edit page
➕ Add page
View
Basic
Show local branches.
$ git branch
foo
* bar
master
Get the current branch.
$ git branch --show-current
bar
Verbose
Show local branches with references to the remote.
$ git branch -v
foo 4c677a0 [gone] Some commit message
* bar a89446e Another message
master 5680e85 Yet another commit message
Remotes
Show only remote branches.
$ git branch -r
origin/bar
origin/HEAD -> origin/master
origin/master
You can also run this with the verbose flag to which commit each points to.
$ git branch -r -v
origin/bar a89446e Another message
origin/HEAD -> origin/master
origin/master 5680e85 Yet another commit message
All
View both local and remote branch references.
$ git branch -a
foo
* bar
master
remotes/origin/bar
remotes/origin/baz
remotes/origin/HEAD -> origin/master
remotes/origin/master