如何通过 Git-show 显示文件最近 5 次提交与当前未提交文件的差异?
我更改了我的文件,这破坏了我的代码。但是,我不知道变化在哪里。
我想将当前未提交的文件与最近的提交 (HEAD)、之前的提交 (^HEAD) 以及至少 3 个更深的提交进行比较。
但是,我不知道如何才能有效地做到这一点。
在试图查看一个文件的最后五次提交对给定分支中当前文件的更改时,我没有成功运行
git show next~5:handle_questions.php
最佳答案
这是我的备忘单:
# uncommited file to HEAD
git diff <path>
# uncommited file to before last commit
git diff HEAD^ -- <path>
#last commit to before last commit
git diff HEAD^ HEAD -- <path>
#difference between HEAD and n-th grandparent
git diff HEAD~n HEAD -- <path>
#Another cool feature is whatchanged command
git whatchanged -- <path>
关于git - 比较 Git 对当前文件的提交更改,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1303315/