Created
August 16, 2017 20:55
-
-
Save steelbrain/3323bea900ada119faa5606ee7e13e1e to your computer and use it in GitHub Desktop.
git-post-pr
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
#!/bin/bash | |
# Usage: | |
# git-post-pr | |
# Description: | |
# Deletes local branch (doesn't force so you won't lose local if not pushed remotely) | |
# Fetches remote so local remote branch is deleted | |
# Switches to master | |
CURRENT_BRANCH="$(git rev-parse --abbrev-ref HEAD)" | |
if [ "$CURRENT_BRANCH" = "master" ]; then | |
echo "You are on master" | |
exit 1 | |
fi | |
git checkout master | |
git branch -d $CURRENT_BRANCH | |
git fetch --prune --all | |
git pull |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment