问题描述
我有一个叫做ticket20的分支,并且我做了10次提交,我想做一个补丁,显示当我第一次创建它(0提交)和现在(第10提交)时ticket20之间的差异。我知道你可以用git diff做一个补丁,但是我不知道如何定位第0次提交和第10次提交。 解决方案
我有一个叫做ticket20的分支,并且我做了10次提交,我想做一个补丁,显示当我第一次创建它(0提交)和现在(第10提交)时ticket20之间的差异。我知道你可以用git diff做一个补丁,但是我不知道如何定位第0次提交和第10次提交。 解决方案
如果您分支 master
,
git diff master。 ..ticket20
如果您使用分支远程或以其他方式跟踪您的分支点, git branch -t
或 git config branch.autosetupmerge true
,
git diff ticket20 @ {u} ... ticket20
如果您已经把它签出,
git diff @ {u} ...
三点语法特定于差异,它表示自合并基础。
I have a branch called ticket20 and I made 10 commits, I want to make a patch that shows the diff between ticket20 when I first created it (0 commit) and now (10th commit). I know you can make a patch with git diff, but I don't know how to target the 0th commit and the 10th commit.
If you branched off master
,
git diff master...ticket20
If you branched off a remote or otherwise tracked your branchpoint with git branch -t
or git config branch.autosetupmerge true
,
git diff ticket20@{u}...ticket20
If you've got it checked out,
git diff @{u}...
The three-dot syntax is specific to diff, it means "since the merge base".
这篇关于你如何制作一个补丁来显示第一次提交之前的分支和同一分支中最后提交的版本之间的区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!