Created
September 27, 2013 14:32
-
-
Save sampart/6729508 to your computer and use it in GitHub Desktop.
PR been merged on github? This will checkout develop, git pull so that develop has the merged changes, and then delete the branch you were on.
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 | |
# PR been merged on github? This will checkout develop, git pull, and then delete the branch you were on. | |
# Thanks http://stackoverflow.com/a/1593487/328817 | |
branch_name="$(git symbolic-ref HEAD 2>/dev/null)" || | |
branch_name="(unnamed branch)" # detached HEAD | |
branch_name=${branch_name##refs/heads/} | |
if [ "$branch_name" = "develop" ] || [ "$branch_name" = "master" ] | |
then | |
echo "Only for feature branches!" | |
exit 1; | |
fi | |
git checkout develop | |
git pull origin develop | |
git branch -d $branch_name | |
git branch # I like to know what branches I've got left |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
It's worth noting that this fork is better as it allows you to specify a branch in place of develop.