当我执行gitdiffCOMMIT时,我看到了提交和HEAD之间的变化(据我所知),但我希望看到单个提交所做的变化。
我还没有在diff/log上找到任何明显的选项来提供输出。
当我执行gitdiffCOMMIT时,我看到了提交和HEAD之间的变化(据我所知),但我希望看到单个提交所做的变化。
我还没有在diff/log上找到任何明显的选项来提供输出。
当前回答
此命令将获取Git父提交哈希:
git log -n 2 <commit-hash>
之后,gitdiff工具<commithash><parentcommithash>
例子:
bonnie@bonnie ~/ $ git log -n 2 7f65b9a9d3820525766fcba285b3c678e889fe3
commit 7f65b9a9d3820525766fcba285b3c678e889fe3b
Author: souparno <souparno.majumder@gmail.com>
Date: Mon Jul 25 13:17:07 2016 +0530
CSS changed to maintain the aspect ratio of the channel logos and to fit them properly.
commit c3a61f17e14e2b80cf64b172a45f1b4826ee291f
Author: souparno <souparno.majumder@gmail.com>
Date: Mon Jul 25 11:28:09 2016 +0530
The ratio of the height to width of the channel images are maintained.
在此之后
git difftool 7f65b9a9d3820525766fcba285b3c678e889fe3b c3a61f17e14e2b80cf64b172a45f1b4826ee291f
其他回答
还可以查看特定文件的两次提交之间的更改。
git diff <commit_Id_1> <commit_Id_2> some_dir/file.txt
首先使用,
git log #to list all
Or
git log -p -1 #last one commit id
复制提交id。
现在我们使用两种方法列出特定提交的更改,
方法1:
git diff commit_id ^#提交id类似于1c6a6000asad012
方法2:
git show commit_id
For example: git show 1c6a600a
您可以在git的特定地址上单击每次提交以查看如果您使用工具提交,您可以通过展会历史记录
Use:
git show <commit_sha>
这将向您展示该承诺中的内容。只需在两个提交SHA-1散列之间放置一个空格,就可以完成范围。
git show <beginning_sha> <ending_sha>
如果您经常重新设置基础,这非常有用,因为您的功能日志都是一行的。
如果您想查看最后3次提交,可以使用HEAD语法
git show HEAD~3 HEAD
我通常会:
git diff HEAD~1
显示有关上次提交的更改。如果您有更多的提交,只需将数字1增加到您希望看到的提交差异。