2011-12-28 3 views
0

Учитывая, что дерево изображено, как показано ниже:Как получить все фиксации между двумя коммитами в дереве версий?

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

a является старейшей фиксации, в то время как i является последним один, в ГОЛОВУ d1a ответвляется мастер на новый филиал разработчика, добавлены некоторые новые изменения и объединены изменения от мастер (от f до d1d), а затем, в конце концов, слились с «мастером» по адресу h.

При выполнении журнала мерзавец/Rev-список, как я выбираю:

  1. все коммиты с головы до е: I, H, G, F, E, D1E, d1d
  2. все коммиты от головы до г: я, ч, г
  3. все коммиты от головы до 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

+0

Попробуйте добавить '--ancestry-path' (из man-страницы git log) – Reactormonk

+0

Хорошо, я тоже пробовал, что -ancestry-path даст что-то вроде i, h, g, f, пропуская коммиты на другом пути. – Justin

Смежные вопросы