Created
January 21, 2022 15:34
-
-
Save KrustyHack/616ce5e1b4f2d9ce51b09e44269fcd6b to your computer and use it in GitHub Desktop.
Hard reset fork from upstream
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 | |
UPSTREAM="$1" | |
read -n 1 -p "/!\\ Keep in mind, that this makes your repo look exactly like upstream - If you have commits, they will be eaten ! /!\\ [y/n]" askinput | |
echo -e "\n" | |
if [ "${askinput}" == "y" ]; then | |
echo -e "Will force reset with upstream" | |
sleep 3 | |
git remote add upstream "${UPSTREAM}" | |
git fetch upstream | |
git reset --hard upstream/master | |
else | |
echo -e "\nAborting" | |
exit 0 | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment