在git中生成特定提交的差异文件 [英] Generate diff file of a specific commit in git
本文介绍了在git中生成特定提交的差异文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
当头部处于特定提交状态时,我想获取一个diff文件,以便可以将头部降低到一个更低的级别,然后在有和没有应用diff文件的情况下尝试测试功能.因此,有一种方法可以生成特定提交的差异文件.
When the head is at a particular commit, I want to get a diff file so that I can reduce the head to one more level down and then try the testing functionality with and without applying the diff file. So is there a way to generate a diff file of a specific commit.
即使可以在提交前后更改头,此方法也更方便.
Even though there is a way to change the head before and after commit, this method comes more handy.
推荐答案
查看特定提交的更改.
$ git diff <commit-sha> -p
OR,
$ git show --decorate <commit-sha> # see 'Author', 'Date' and 'diff'
查看两次提交的区别.
$ git diff <commit1> <commit2>
请参阅file
更改以进行特定的提交.
See the file
changes for a specific commit.
$ git show <commit>:<file>
查看一段时间内的所有更改(例如1 day
).
See all the changes for a time duration (say, 1 day
).
$ git whatchanged --since="1 day ago" -p
$ git whatchanged --since="1 day ago" -p <file> # see changes for a specific file only
这篇关于在git中生成特定提交的差异文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文