Skip to content

Instantly share code, notes, and snippets.

@dblock
Created June 9, 2011 21:12
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dblock/1017765 to your computer and use it in GitHub Desktop.
Save dblock/1017765 to your computer and use it in GitHub Desktop.
Delete merged git branches.
git branch --merged | grep -v master | xargs git branch -d
git branch -r --merged | awk -F'/' '/^ *origin/{if(!match($0, /(>|master)/)){print $2}}' | xargs git push origin --delete
@SvanBoxel
Copy link

You could also use this app to auto delete merged branches.

@hartwork
Copy link

Or you could use git-delete-merged-branches. If can delete both local and remote branches, detects squash merges, and more.

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