Skip to main content

Working with branches

Examples of git commands to work with branches.

Get all branches

git branch -a

Checkout a targetBranch

git checkout targetBranch

Create a newBranch from the current branch

git checkout -b newBranch

Delete dangling local branches after deletion of remote ones

git remote prune origin