* Re: One question about git-format-patch
[not found] <804161F448B352478D7503429A0B7F27CA94AC@ex10-mbx-36002.ant.amazon.com>
@ 2013-07-19 23:06 ` Junio C Hamano
2013-07-20 0:32 ` Junio C Hamano
0 siblings, 1 reply; 2+ messages in thread
From: Junio C Hamano @ 2013-07-19 23:06 UTC (permalink / raw)
To: Hua, Siyuan; +Cc: git
> I’m a git user, and recently I’ve noticed there’re some differences between
> “$ git format-patch –n” and “$ git format-patch HEAD~n”. According to the
> documentation: “-<n> Prepare patches from the topmost <n> commits.”
Correct. However, HEAD~n will prepare patches for commits that are
not ancestor of HEAD~n.
And there may well be a lot more than n such commits, unless you are
working on a strictly linear history.
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: One question about git-format-patch
2013-07-19 23:06 ` One question about git-format-patch Junio C Hamano
@ 2013-07-20 0:32 ` Junio C Hamano
0 siblings, 0 replies; 2+ messages in thread
From: Junio C Hamano @ 2013-07-20 0:32 UTC (permalink / raw)
To: Hua, Siyuan; +Cc: git
Junio C Hamano <gitster@pobox.com> writes:
>> I’m a git user, and recently I’ve noticed there’re some differences between
>> “$ git format-patch –n” and “$ git format-patch HEAD~n”. According to the
>> documentation: “-<n> Prepare patches from the topmost <n> commits.”
>
> Correct. However, HEAD~n will prepare patches for commits that are
> not ancestor of HEAD~n.
>
> And there may well be a lot more than n such commits, unless you are
> working on a strictly linear history.
Every once in a while, a illustration would help new folks.
In this history (as always, the time and ancestry topology flows
from left to right):
E-------F---G
/ /
A---B---C---D
imagine that your HEAD is at commit G.
- G~1 == G^ == F
- G~2 == G^^ == E (suppose F is a merge of D made on E)
- G~3 == G^^^ == B
- G~4 == G^^^^ == A
so "git format-patch HEAD~4" will give you B, C, D, E and G (five
commits).
Asking for "git format-patch -n 4" does not make much sense in a
history like this, but it will give you G, D, C, E and at that point
you have seen 4 commits, so you won't get B.
Note that if F were a merge of E made on D, that would make
- G~2 == G^^ == D
- G~3 == G^^^ == C
- G~4 == G^^^^ == B
And "git format-patch HEAD~4" will give you C, D, E and G (four
commits).
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2013-07-20 0:32 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <804161F448B352478D7503429A0B7F27CA94AC@ex10-mbx-36002.ant.amazon.com>
2013-07-19 23:06 ` One question about git-format-patch Junio C Hamano
2013-07-20 0:32 ` Junio C Hamano
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.