Skip to content

Instantly share code, notes, and snippets.

@steelbrain
Created August 16, 2017 20:55
Show Gist options
  • Save steelbrain/3323bea900ada119faa5606ee7e13e1e to your computer and use it in GitHub Desktop.
Save steelbrain/3323bea900ada119faa5606ee7e13e1e to your computer and use it in GitHub Desktop.
git-post-pr
#!/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