Skip to content

Instantly share code, notes, and snippets.

@kellyfj
Last active April 25, 2019 14:55
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kellyfj/702db34caa807a509c79 to your computer and use it in GitHub Desktop.
Save kellyfj/702db34caa807a509c79 to your computer and use it in GitHub Desktop.
To find and clean-up old Git remote branches that have been merged to master
#List all remote branches merged to master
git branch -r --merged
#For all old branches log last commit e.g.
git log --decorate -1 origin/Gauss
#To delete the branches you want
git push origin --delete Gauss
#For everyone to run locally to remove the remove references
git remote prune origin
#To show the # of branches remaining
git branch -r | wc -l
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment