Updated: 24 January 2026
Create a branch and switch to it at the same time
git checkout -b iss53
Delete a remote branch
git push origin --delete feature/login
Delete a remote tracking branch
git branch -d -r remote-name/branch-name
Remove upstream info for the_branch.
git branch the_branch --unset-upstream
Delete a local branch
git branch -d branch-name
Rename a branch
git branch -m <old> <new>
Show as much branch information as possible
git branch -avv
List both remote-tracking branches and local branches
git branch -a
git branch --all
Show commit hash, subject and remote branch for each head. Also print path of any linked worktree.
git branch -vv
Move branch pointer to another arbitrary commit
git branch --force <branch> <commit>
Create new branch at arbitrary commit
git branch branch_name commit_hash
Push all branches to a remote
git push origin --all