git-branch
2024-03-28
branch
git
softwares-and-tools
git branchMain Git command for working with branches.
More information: https://git-scm.com/docs/git-branch.List all branches (local and remote; the current branch is highlighted by *):
git branch --allList which branches include a specific Git commit in their history:
git branch --all --contains commit_hashShow the name of the current branch:
git branch --show-currentCreate new branch based on the current commit:
git branch branch_nameCreate new branch based on a specific commit:
git branch branch_name commit_hashRename a branch (must not have it checked out to do this):
git branch -m old_branch_name new_branch_nameDelete a local branch (must not have it checked out to do this):
git branch -d branch_nameDelete a remote branch:
git push remote_name --delete remote_branch_nam