Created
October 10, 2018 19:36
-
-
Save eegeeZA/1043bb894f2393cb45b759af35918cb0 to your computer and use it in GitHub Desktop.
Example of how a commit might go "missing" when renamed on Git
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
git checkout -b branch1 | |
touch test.txt | |
git add . | |
git commit -m "Commit 1" | |
for i in `seq 1 10`; do echo $i >> test.txt; done | |
git add . | |
git commit -m "Commit 2" | |
git checkout -b branch2 | |
mv test.txt renamed.txt | |
git add . | |
git commit -m "Commit 3" | |
git checkout branch1 | |
rm test.txt | |
touch test.txt | |
for i in `seq 1 4`; do echo $i >> test.txt; done | |
for i in `seq 8 10`; do echo $i >> test.txt; done | |
git add . | |
git commit -m "Commit 4 (missing)" | |
git checkout branch1 | |
git merge branch2 --no-edit | |
for i in `seq 5 7`; do echo $i >> renamed.txt; done | |
git add . | |
git commit -m "Commit 5" | |
#missing commit | |
git log --follow -- renamed.txt | |
# vs all commits | |
git log --follow --topo-order -- renamed.txt |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment