当我执行git diff COMMIT
命令时,我看到的是该提交和HEAD之间的更改(就我所知),但我想要查看单个提交所做的更改。
我没有在diff
/log
上找到任何明显的选项可以给我这个输出。
当我执行git diff COMMIT
命令时,我看到的是该提交和HEAD之间的更改(就我所知),但我想要查看单个提交所做的更改。
我没有在diff
/log
上找到任何明显的选项可以给我这个输出。
git log -n 2 <commit-hash>
之后执行git diff-tool <commit-hash> <parent-commit-hash>
例子:
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~ COMMIT
git diff "COMMIT^" COMMIT
获取提交中更改的文件列表:
git show --name-only commit_id
注意:上述命令不适用于合并 ID。
获取合并提交ID中更改的文件列表:
git log -m -1 --name-only commit_id
查看提交中特定文件的更改:
git show commit_id:src/path/to/that/file
git show commit_id -- src/path/to/that/file
е‘Ҫд»ӨжқҘиҺ·еҸ–еҪ©иүІиҫ“еҮәгҖӮ - Eric还可以查看特定文件在两个提交之间的更改记录。
git diff <commit_Id_1> <commit_Id_2> some_dir/file.txt
git diff <commit_Id> on/specific/file.txt
- CallMarlgitk
不是 git
,它是一个特定的软件包,在安装了 git
的每个操作系统上都不存在。tig
也是很好的工具之一,还有许多其他工具可供选择。 - CallMarl