2011-12-28 76 views
0

鉴于有描述如下树:如何获取版本树中两次提交之间的所有提交?

 d1a--d1b---d1c--d1d--d1e  <dev> 
    /   / \ 
a--b--c---d---e--------f---g----h--i <master> 

a是最古老的承诺,而i是最新的一个,该HEAD d1a分支出来到一个新的分支开发,添加了一些新的更改和(从fd1d)合并的更改,然后最终合并回h'主'。

在做git的日志/转列表,我该如何选择:

  1. 从头部所有提交到E: I,H,G,F,E,D1E,D1D
  2. 所有提交从头部到G: I,H,G
  3. 所有从HEAD提交到D1B: I,H,G,F,D1E,D1D,D1C,D1B

许多提前任何指针感谢/建议/提示!

回答

-1

man git-rev-parse

SPECIFYING RANGES 
    History traversing commands such as git log operate on a set of commits, not just a single commit. To these 
    commands, specifying a single revision with the notation described in the previous section means the set of commits 
    reachable from that commit, following the commit ancestry chain. 

    To exclude commits reachable from a commit, a prefix^notation is used. E.g. ^r1 r2 means commits reachable from r2 
    but exclude the ones reachable from r1. 

    This set operation appears so often that there is a shorthand for it. When you have two commits r1 and r2 (named 
    according to the syntax explained in SPECIFYING REVISIONS above), you can ask for commits that are reachable from r2 
    excluding those that are reachable from r1 by ^r1 r2 and it can be written as r1..r2. 

    A similar notation r1...r2 is called symmetric difference of r1 and r2 and is defined as r1 r2 --not $(git 
    merge-base --all r1 r2). It is the set of commits that are reachable from either one of r1 or r2 but not from both. 

    Two other shorthands for naming a set that is formed by a commit and its parent commits exist. The r1^@ notation 
    means all parents of r1. r1^! includes commit r1 but excludes all of its parents. 

甚至还有一个例子,所以我RTFM ;-)

+0

THX的答复! 但是,我做了RTFM ...并没有像预期的那样工作。 我做了:git log .. 但是得到了i,h,g,f,d1e,d1d,d1c,d1b,d1a ... ,显然这不是我想要的。 有什么想法? – Justin 2011-12-28 09:17:18

+0

尝试添加'--ancestry-path'(来自git log联机帮助页) – Reactormonk 2011-12-28 12:13:52

+0

好吧,我也试过,--ancestry-path会给出类似于i,h,g,f的内容,跳过其他路径上的提交。 – Justin 2011-12-28 12:28:15

相关问题