Skip to content

Instantly share code, notes, and snippets.

@haavamoa
Created June 7, 2019 13:30
Show Gist options
  • Save haavamoa/ba1f675e5a6fbd9ea98468b21caaa010 to your computer and use it in GitHub Desktop.
Save haavamoa/ba1f675e5a6fbd9ea98468b21caaa010 to your computer and use it in GitHub Desktop.
#################################################################################################
# Checkout master, pull from master, prune master to remove branches that are merged with master
#################################################################################################
function gitcleanmaster(){
git checkout master
git pull
git remote prune origin
git branch --merged | grep -v "\*" | xargs -rn 1 git branch -d
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment