Skip to content

Instantly share code, notes, and snippets.

@bjorg
Created April 9, 2013 22:02
Show Gist options
  • Select an option

  • Save bjorg/5349811 to your computer and use it in GitHub Desktop.

Select an option

Save bjorg/5349811 to your computer and use it in GitHub Desktop.
Script to delete all local branches that have been merged into the local master branch. Useful to run after update local master and removing old branches that have already been merged. **IMPORTANT:** make sure to switch to 'master' before you run this command.
#!/bin/sh
git branch --merged master | grep -v "\*" | xargs -n 1 git branch -d
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment