Skip to content

Instantly share code, notes, and snippets.

@sbilstein
Created April 13, 2018 21:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sbilstein/1e7dc6f16f057b5f4f56fc2a3fd7698a to your computer and use it in GitHub Desktop.
Save sbilstein/1e7dc6f16f057b5f4f56fc2a3fd7698a to your computer and use it in GitHub Desktop.
remaster
#!/bin/sh
branch=`git branch | grep \* | cut -d ' ' -f2`
if [ $branch = 'master' ]; then
echo "Can't remaster on master" >&2
exit 1
fi
ref=`git rev-parse $branch`
echo "To restore your branch ($branch), run the following:"
echo " git checkout $ref"
git checkout master
git pull
git checkout $branch
git rebase -i master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment