git diff/log and the order of start/end commits specified -
when running git log or git diff seems order of how commits specified important.
tip of branch is: 8ad4ff890446 , base of branch is: 6e91a6615
when run git log tip base get:
$ git log --oneline 8ad4ff890446..6e91a6615 d9b526fb ... a5f4ad92 ... af96bb6c ... 8d416ba9 ... c7a37d4f ... if reverse arguments , run git log base tip get:
$ git log --oneline 6e91a6615..8ad4ff890446 2d6055e7 ... 656ac5b3 ... 3a4e2bbc ... the last call expect - 3 commits introduced since base.
why 3 commits (correct) when going base -> tip compared 5 commits when going tip -> base?
the double dot syntax doesn't mean "going x y", means this:
the common range specification double-dot syntax. asks git resolve range of commits reachable 1 commit aren’t reachable another.
a simple example demonstrate output this:
master v a---b---c---d---e---f---g---h---i \ \-j---k---l ^ branch here master ahead of branch 5 commits , branch ahead of master 3 commits.
in case, command:
git log branch..master should list 5 commits e-i, whereas this:
git log master..branch should list 3 commits j-l.
if you're on windows can open command prompt , navigate temporary or new (empty) folder somewhere , paste these commands in, executing them:
git init %f in (a b c d e f g h i) (echo %f>test.txt && git add . && git commit -m "%f") git checkout head~5 -b branch %f in (j k l) (echo %f>test.txt && git add . && git commit -m "%f") afterwards can execute these commands , inspect output
git log branch..master git log master..branch
Comments
Post a Comment