Created
June 25, 2015 15:35
-
-
Save shoaibi/9f75d1781380c6eeaa60 to your computer and use it in GitHub Desktop.
Remove a git branch
This 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 characters
| #!/bin/bash | |
| origBranch=$(git rev-parse --abbrev-ref HEAD) | |
| delBranch="$1" | |
| E_BADARGS=65 | |
| if [ $# -ne 1 ]; then | |
| echo "Usage: $0 {branch_name}" | |
| exit $E_BADARGS | |
| fi | |
| git checkout "$delBranch" && git checkout "$origBranch" && git branch -D "$delBranch" && git push origin ":$delBranch" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment