Last active
March 4, 2020 16:38
-
-
Save MiffOttah/8576c3f617a61aebf4f8ba90079bc365 to your computer and use it in GitHub Desktop.
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 | |
# git-gud - deletes all local data and refetches the entire repo from the origin | |
TOPLEVEL=`git rev-parse --show-toplevel` | |
if [ -z "$TOPLEVEL" ]; then | |
echo 'Not in a git repository.' | |
exit 1 | |
fi | |
ORIGIN=`git remote show origin` | |
if [ -z "$ORIGIN" ]; then | |
echo 'Git repository doesn't have a remote origin.' | |
exit 2 | |
fi | |
rm -rf $TOPLEVEL | |
git clone $ORIGIN $TOPLEVEL |
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 | |
# git-rekt - forces your data into the remote master | |
TOPLEVEL=`git rev-parse --show-toplevel` | |
if [ -z "$TOPLEVEL" ]; then | |
echo 'Not in a git repository.' | |
exit 1 | |
fi | |
ORIGIN=`git remote show origin` | |
if [ -z "$ORIGIN" ]; then | |
echo 'Git repository doesn't have a remote origin.' | |
exit 2 | |
fi | |
cd $TOPLEVEL | |
rm -rf $TOPLEVEL/.git | |
git clone --bare $ORIGIN $TOPLEVEL/.git | |
git add . | |
git commit -m "git-rekt, scrub!" | |
git push |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment