Created
November 10, 2015 19:09
-
-
Save olix0r/d470cf109bc1bd0db46d to your computer and use it in GitHub Desktop.
a little script for reaping a merged working 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/sh | |
set -e | |
# When the current branch has been merged to the origin, update master | |
# and delete the local branch. | |
branch=$(git rev-parse --abbrev-ref HEAD) | |
if [ -z "$branch" ]; then | |
echo "Could not parse branch" >&2 | |
exit 1 | |
elif [ "$branch" = "master" ]; then | |
echo "Already on master" >&2 | |
exit 2 | |
else | |
echo ":; :; git co master" | |
git co master | |
echo ":; :; git pull origin master" | |
git pull origin master | |
echo ":; :; git branch -d $branch" | |
git branch -d "$branch" | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment