Created
July 25, 2016 04:20
-
-
Save karuppasamy/591d484b4211636785ac16d5e19c7f6b to your computer and use it in GitHub Desktop.
Git - Delete remote branches
This file contains 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 characters
# Delete remote branches except `master` and `development` | |
git branch -r --merged | grep origin | grep -v '>' | grep -v master | grep -v development | grep -v sprint | xargs -L1 | cut -d"/" -f2- | xargs git push origin --delete > ~/Documents/remote_branch |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Workout
git branch -r --merged |
grep origin |
grep -v '>' |
grep -v master |
xargs -L1 |
cut -d"/" -f2- |
xargs git push -d b
git branch -r --merged | grep origin | grep -v '>' | grep -v master | grep -v development | grep -v sprint > ~/Documents/remote_branch
git branch -r --merged | grep origin | grep -v '>' | grep -v master | grep -v development | grep -v sprint | xargs -L1 | cut -d"/" -f2- > ~/Documents/remote_branch
git branch -r --merged | grep origin | grep -v '>' | grep -v master | grep -v development | grep -v sprint | xargs -L1 | cut -d"/" -f2- | xargs git push origin --delete > ~/Documents/remote_branch
git branch -r --merged | grep origin | grep -v '>' | grep -v master | grep -v development | xargs -L1 | cut -d"/" -f2- | xargs git push origin --delete > ~/Documents/remote_branch