Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
git
# http://stevenharman.net/git-clean-delete-already-merged-branches
# delete branch that is already merge to head
git branch --merged | grep -v "\*" | xargs -n 1 git branch -d
# delete git branch that is already merge to master
git branch --merged master | grep -v "\* master" | xargs -n 1 git branch -d
# delete git branch that is already merge to origin master
git branch --merged origin/master | grep -v "\*" | xargs -n 1 git branch -d
git revert dcad129d8be57218f1751cda475dd3df6298f79e -m 1

Example merge commit

commit dcad129d8be57218f1751cda475dd3df6298f79e
Merge: 8989ee0 7c6b236
Author: Ben James <ben@example.com>
Date:   Wed Aug 17 22:49:41 2011 +0100

-m specify which parent to revert to. Typically it is the first one. Check with git log to make sure

More Info

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment