【发布时间】:2011-12-07 05:38:12
【问题描述】:
我有一个文件a.txt。
cat a.txt
> hello
a.txt的内容是“hello”。
我做出承诺。
git add a.txt
git commit -m "first commit"
然后我将a.txt 移动到test 目录中。
mkdir test
mv a.txt test
然后我进行第二次提交。
git add -A
git commit -m "second commit"
最后,我编辑a.txt 改为说“再见”。
cat a.txt
> goodbye
我做了最后一次提交。
git add a.txt
git commit -m "final commit"
现在这是我的问题:
我如何区分我上次提交和第一次提交之间的a.txt 的内容?
我试过了:
git diff HEAD^^..HEAD -M a.txt,但这不起作用。 git log --follow a.txt 正确检测到重命名,但我找不到 git diff 的等价物。有吗?
【问题讨论】:
-
我想如果你做一个'git mv a.txt test'会是一样的吗? IE 你只是重命名了文件,而不是将它移动到子目录中。