Skip to content

Instantly share code, notes, and snippets.

@donovank
Last active April 29, 2017 20:13
Show Gist options
  • Save donovank/f6cea1ba89528ccce6dcfe75dcae5d9c to your computer and use it in GitHub Desktop.
Save donovank/f6cea1ba89528ccce6dcfe75dcae5d9c to your computer and use it in GitHub Desktop.
Forksync's counter partner, forkwipe, fully restores from a master branch.
forkwipe () {
if [ ! -d ".git" ]; then
echo "Make sure your in the root of a github repo."
return
fi
if cat .git/config | grep -i -q 'remote "upstream"' .git/config; then
git fetch upstream
git checkout master
git reset --hard upstream/master
git push origin master --force
git add .
git commit -m "forkwipe"
git push
else
echo "please run the following:"
echo "git remote add upstream git@github.com:username/repo.git"
fi
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment