git branch

Updated: 28 August 2024

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>

List both remote-tracking branches and local branches

git branch -a

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

Leave a comment