Git Commands

A Reference Guide

Git Branch Commands


  • git branch - Display a list of the local branches in your Git repository.
  • git branch -a - Display a list of both local branches and remote branches in your Git repository.
  • git branch -c - Copy a Git branch.
  • git branch -d <branch-name> - Delete a local Git branch. This command will not work if the branch you are attempting to delete has unmerged changes.
  • git branch -D <branch-name> - Delete a local Git branch with unmerged changes.
  • git branch -m <branch-name> <new-branch-name> - Rename a Git branch.
  • git branch -r - Display a list of the remote branches in your Git repository.
  • git push <remote> --delete <remote-branch-name> - Delete a remote Git branch.
  • git push --set-upstream <remote> <branch> - Set an upstream branch. Running this command will push your local branch to the new remote branch.

Git Cherry Pick Commands



Get updates when we publish new concepts by signing up for our newsletter!