different between two dots and three

In git the range notation behave differently between log and diff

     A---B---C topic
     /
D---E---F---G master

Git log

two dots (..)

git log topic..master : in master but not in topic (G, F)

git log master..topic : in topic but not master (C, B, A)

three dots (...)

git log topic...master : in master and in topic but **not both ** (G, F, C, B, A)

git log master...topic : the same (G, F, C, B, A)

Git diff

two dots (..)

git diff topic..master : what is and what not in master compared to topic (D, E, -A, -B, -C, +F, +G)

git diff master..topic : what is and what not in topic compared to master (D, E, -F, -G, +A, +B, +C)

three dots (...)

git diff topic...master : in master but not in _topic_** ** (D, E, +F, +G)

git diff master...topic : in topic but not in _master_** ** (D, E, +A, +B, +C)

Last updated