Git:自提交以来的差异

Git: Differences since a commit

鉴于此输出:

c:\git\xxx>git log --oneline -n 5    
b99c981 Merge remote-tracking branch 'origin/xxx-newfeature' into xxx-blah
e53f30a [maven-release-plugin] prepare for next development iteration
e40978b [maven-release-plugin] prepare release xxx-3.9.6
0639706 Modified Ant installion path
654ef47 [maven-release-plugin] prepare for next development iteration

要查看的 GIT diff 命令是什么:

  1. 刚刚提交 0639706 发生了什么变化
  2. 所有提交中发生了什么变化 自(包括)提交 0639706

请注意,我一直在使用 git difftool 来直观地查看差异(当我能弄清楚我在差异什么时..)

第一个,试试

git show 0639706

或者,您可以这样做

git diff 0639706~1 0639706

对于第二个,

git diff 0639706~1

应该可以解决问题。如果您只想查看文件名而不是整个差异,则可以在任一命令中使用 --name-only 选项。

假设 "what changed" 你的意思是 "produce diff output detailing the changes":

What changed in just commit 0639706

git show 0639706

What changed in all commits since (and including) commit 0639706

git log -p 0639706