相关疑难解决方法(0)

git diff重命名文件

我有一个文件a.txt.

cat a.txt
> hello
Run Code Online (Sandbox Code Playgroud)

内容a.txt是"你好".

我做了一个提交.

git add a.txt
git commit -m "first commit"
Run Code Online (Sandbox Code Playgroud)

然后我a.txt进入了一个test目录.

mkdir test
mv a.txt test
Run Code Online (Sandbox Code Playgroud)

然后我做了第二次提交.

git add -A
git commit -m "second commit"
Run Code Online (Sandbox Code Playgroud)

最后,我编辑a.txt说"再见".

cat a.txt
> goodbye
Run Code Online (Sandbox Code Playgroud)

我做了最后一次提交.

git add a.txt
git commit -m "final commit"
Run Code Online (Sandbox Code Playgroud)

现在这是我的问题:

如何区分a.txt上次提交和第一次提交之间的内容?

我试过了 git diff HEAD^^..HEAD -M a.txt,但是那没用. git log --follow a.txt正确检测重命名,但我找不到相应的git diff.有吗?

git diff rename

99
推荐指数
3
解决办法
2万
查看次数

标签 统计

diff ×1

git ×1

rename ×1