Git Branch

The git branch command is for working with branches.

Command Abbreviated Description
git branch this will list the local branches, with the current one highlighted
git branch --list -l this is the same as just doing git branch
git branch --verbose -v list the branches with info on the latest commit
git branch -vv same as git branch --verbose but adds remote branch being tracked
git branch --all -a like git branch --list but includes remote as well as local branches
git branch --delete mybranch -d delete the local branch called "my-branch"
git branch --delete --force -D this deletes "my-branch" and will also abandon unmerged changes

The best way to see what is going on with all the branches is to use git branch --all -vv, so see all the verbose details on all the branches.

It is also worth looking at some other git commands that work with branches.

Command Abbreviated Description
git checkout my-branch switch to an existing branch
git checkout -b new-branch create a new local branch and switch to it
git pull pull changes on remote branch down to my local branch
git push origin my-branch push my local branch to my remote, called "origin"
git push --delete origin my-branch delete my remote branch

See also: