-
-
Save matschaffer/942981 to your computer and use it in GitHub Desktop.
delete all remote branches that have already been merged into master
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ git branch -r --merged | | |
sed '/>|master/d;/origin/!d;s:origin/::' | | |
xargs git push origin --delete | |
# I think this will work, but I don't know how to get git branch to show me that -> line |
Guessing https://stackoverflow.com/questions/6127328/how-can-i-delete-all-git-branches-which-have-been-merged is the place to go now. Pretty sure I made this gist before SO existed :)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This shows me the -> line:
git branch -r --merged | grep '>'
The output is essentially:
origin/HEAD -> origin/main
(it also showed one branch with a long name that contains a '>')