Git log --follow
2019-11-04 本文已影响0人
JaedenKil
#1. Mkdir && cd
mkdir GitFollowDemo
cd GitFollowDemo/
#2. Git init
git init
#3. Init a file
touch test.txt
echo "Hello World" > test.txt
git add test.txt
git commit -m "Add test.txt"
#4. Update the file
echo "Update" >> test.txt
git add -u
git commit -m "Update test.txt"
#5. Rename
mv test.txt newTest.txt
git add .
git commit -m "Rename the txt file"
#6. Update the new file
echo "Update the new filr" >> newTest.txt
git add -u
git commit -m "Update the new file"
# Show all history
$ git log --oneline
9787b51 (HEAD -> master) Update the new file
8b811d0 Rename the txt file
5e727da Update test.txt
9194886 Add test.txt
# Show history for 'test.txt'
$ git log --oneline -- test.txt
8b811d0 Rename the txt file
5e727da Update test.txt
9194886 Add test.txt
$ git log --follow --oneline -- test.txt
8b811d0 Rename the txt file
5e727da Update test.txt
9194886 Add test.txt
# Show history for 'newTest.txt'
$ git log --oneline -- newTest.txt
9787b51 (HEAD -> master) Update the new file
8b811d0 Rename the txt file
$ git log --follow --oneline -- newTest.txt
9787b51 (HEAD -> master) Update the new file
8b811d0 Rename the txt file
5e727da Update test.txt
9194886 Add test.txt