Skip to content

Instantly share code, notes, and snippets.

@fuyi
Last active August 29, 2015 14:12
Show Gist options
  • Save fuyi/c7bccdb9e5f924da4c92 to your computer and use it in GitHub Desktop.
Save fuyi/c7bccdb9e5f924da4c92 to your computer and use it in GitHub Desktop.
git remove branch

To delete a local branch

git branch -d the_local_branch

To remove a remote branch (if you know what you are doing!)

git push origin :the_remote_branch

Someone else has already deleted the branch. try to synchronize your branch list with

git fetch -p

Clean merged remote branchs

git branch -r --merged |  grep origin |  grep -v '>' |  grep -v master |  xargs -L1 |  cut -d"/" -f2- | xargs git push origin --delete
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment