Как получить все коммиты между двумя коммитами в дереве версий? - PullRequest
0 голосов
/ 28 декабря 2011

Учитывая, что дерево изображено ниже:

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

a - самый старый коммит, в то время как i - самый последний, HEAD d1a ответвляется от master до новой ветви dev , добавлены некоторые новые изменения и объединены изменения с master f до d1d) и затем, в конце концов, слились с 'master' в h.

Когда я делаю git log / rev-list, как выбрать:

  1. все коммиты из HEAD на e: i, h, g, f, e, d1e, d1d
  2. все коммиты из HEAD в g: я, ч, г
  3. все коммиты из HEAD в d1b: i, h, g, f, d1e, d1d, d1c, d1b

Большое спасибо заранее за любые указатели / предложения / подсказки!

1 Ответ

0 голосов
/ 28 декабря 2011

С 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; -)

...