Last active
December 18, 2015 21:59
-
-
Save ianmariano/5851658 to your computer and use it in GitHub Desktop.
Quick Git plugin to close a branch (return you to master and clean up your remote and local topic branches) when merged in a pull request. Place on your path and chmod a+x it. Use: git close-branch branchname
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 | |
usage() { | |
echo "Usage $0 branchname" | |
exit 1 | |
} | |
if [ -z "$1" ]; then | |
usage | |
fi | |
if ! git diff --quiet; then | |
echo "You have uncommitted changes." | |
exit 1 | |
fi | |
git checkout master | |
git push origin :$1 | |
git branch -D $1 | |
exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment