当我执行gitdiffCOMMIT时,我看到了提交和HEAD之间的变化(据我所知),但我希望看到单个提交所做的变化。
我还没有在diff/log上找到任何明显的选项来提供输出。
当我执行gitdiffCOMMIT时,我看到了提交和HEAD之间的变化(据我所知),但我希望看到单个提交所做的变化。
我还没有在diff/log上找到任何明显的选项来提供输出。
当前回答
要通过提交查看作者和时间,请使用gitshowCOMMIT。这将导致如下情况:
commit 13414df70354678b1b9304ebe4b6d204810f867e
Merge: a2a2894 3a1ba8f
Author: You <you@you.com>
Date: Fri Jul 24 17:46:42 2015 -0700
Merge remote-tracking branch 'origin/your-feature'
如果您想查看哪些文件已更改,请使用上面“合并”行中的值运行以下命令:git diff--stat a2a2894 3a1ba8f。
如果要查看实际差异,请运行git-stat a2a2894 3a1ba8f。
其他回答
如果在图形视图中检查源更改,请使用:
gitk (your commit id goes here)
例如:
gitk HEAD~1
要通过提交查看作者和时间,请使用gitshowCOMMIT。这将导致如下情况:
commit 13414df70354678b1b9304ebe4b6d204810f867e
Merge: a2a2894 3a1ba8f
Author: You <you@you.com>
Date: Fri Jul 24 17:46:42 2015 -0700
Merge remote-tracking branch 'origin/your-feature'
如果您想查看哪些文件已更改,请使用上面“合并”行中的值运行以下命令:git diff--stat a2a2894 3a1ba8f。
如果要查看实际差异,请运行git-stat a2a2894 3a1ba8f。
此命令将获取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
如果您只想查看最新提交中的更改,只需gitshow即可。
检查文件更改的更简单方法(示例)
# 1. Checkout a branch and see the list of commits
git log --oneline -5
# > Output
9b9b1f8 (HEAD -> master) Updated ABC
d58e5da chore: Added files
5a4aa2c chore: Added my pipeline
bb2b0b7 feat: Added ABC
473f711 feat: Added ZYX
# 2. Pick a commit hash and check which files were modified
git show --stat --oneline d58e5da
# > Output
d58e5da chore: Added versioning files
Someabcfile | 18 ++++++++++++++++++
myfolder/file.py | 19 +++++++++++++++++++
myfolder/file.js | 7 +++++++
myfolder/file.txt | 1 +
4 files changed, 45 insertions(+)
# 3. Pick a file to check the differences
git show d58e5da myfolder12/file.py
或者,从列表中检查一次提交中的所有文件差异:
git show d58e5da