Created
October 4, 2017 20:46
-
-
Save simonbyrne/e8923aec3b27b285789efcd616114a95 to your computer and use it in GitHub Desktop.
Create a bad git repository
This file contains hidden or 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
git init --bare gitprob | |
git clone gitprob gitprobwork | |
cd gitprobwork | |
echo "good" > aaaa | |
GOOD=$(git hash-object -w aaaa) | |
git add aaaa | |
git commit -m "1" | |
rm aaaa | |
echo "more good" > aaaa | |
git add aaaa | |
git commit -m "2" | |
git push | |
# hash bad contents | |
echo "bad" > badfile | |
BAD=$(git hash-object -w badfile) | |
cd .. | |
rm -f gitprob/objects/${GOOD:0:2}/${GOOD:2} | |
mv gitprobwork/.git/objects/${BAD:0:2}/${BAD:2} gitprob/objects/${GOOD:0:2}/${GOOD:2} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment