Last active
          March 22, 2019 07:58 
        
      - 
      
- 
        Save zacdaryl/2daef2c7bac3b01d9423c724b4b9f1fe to your computer and use it in GitHub Desktop. 
Revisions
- 
        zacdaryl renamed this gist Mar 22, 2019 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewingFile renamed without changes.
- 
        zacdaryl created this gist Mar 22, 2019 .There are no files selected for viewingThis file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,16 @@ #!/bin/bash # Delete remote branches which have merged to master if [[ $1 == '-r' ]]; then git branch --all --merged remotes/origin/master | \ grep --invert-match master | \ grep --invert-match HEAD | \ grep "remotes/origin/" | \ cut -d "/" -f 3- | \ xargs -n 1 git push --delete origin exit 0 fi # Delete local branches which have merged to master git branch -d `git branch --merged | grep --invert-match master`