如何使用 git 命令显示在指定哈希值处更改文件的历史记录?
How can I show the history that changed files at specify hash using git command?
我可以使用 Github 或 Git Tools(SourceTree, SmartGit).
显示更改文件的历史记录
如何使用 Git 命令显示更改指定哈希值的文件的历史记录?
您可以使用 git-log
and show those changes with git-show
显示影响给定文件的提交 SHA,正如@joanis 建议的那样:
git log <path>
git show <hash> <path>
您也可以使用 git-diff
显示此输出。如果您希望通过多次提交而不是一次提交来查看文件的更改,但代价是更加冗长,这可能会更有帮助:
# changes made by the commit
git diff <hash>~ <hash> <path>
# changes made by the commit and the previous one
git diff <hash>~2 <hash> <path>
有关引用先前提交的更多信息,请参见this question
我可以使用 Github 或 Git Tools(SourceTree, SmartGit).
显示更改文件的历史记录如何使用 Git 命令显示更改指定哈希值的文件的历史记录?
您可以使用 git-log
and show those changes with git-show
显示影响给定文件的提交 SHA,正如@joanis 建议的那样:
git log <path>
git show <hash> <path>
您也可以使用 git-diff
显示此输出。如果您希望通过多次提交而不是一次提交来查看文件的更改,但代价是更加冗长,这可能会更有帮助:
# changes made by the commit
git diff <hash>~ <hash> <path>
# changes made by the commit and the previous one
git diff <hash>~2 <hash> <path>
有关引用先前提交的更多信息,请参见this question