q0987
q0987

Reputation: 36002

why `git log` doesn't find commit difference between local and remote branch?

$ git branch
* bugfix_1000
  master

$ git branch -vv
* bugfix_1000     1c51ced [origin/bugfix/fix1000: ahead 2] Merge branch 'master' into bugfix_1000
  master                433ecee [origin/master] TREIT-4160 | NCC - Follow Up Fixes

$ git log --oneline bugfix_1000..origin/bugfix/fix1000

$ git log --oneline bugfix_1000 -n 5
1c51ced Merge branch 'master' into bugfix_1000
2184619 xxxxx
7397a4e yyyyy

$ git log --oneline origin/bugfix/fix1000 -n 5
2184619 xxxxx
7397a4e yyyyy

Question> From git branch -vv, we can the bugfix_1000 is ahead of 2. Why git log --oneline bugfix_1000..origin/bugfix/fix1000 doesn't display the different?

Thank you

Upvotes: 0

Views: 33

Answers (1)

morxa
morxa

Reputation: 3384

The revision range bugfix_1000..origin/bugfix/fix1000 is empty, and therefore git log bugfix_1000..origin/bugfix/fix1000 does not show anything. The revision range is empty because there is no commit that is in origin/bugfix/fix1000 but not in bugfix_1000. A revision range is always specified as from..to and not to..from. Only the changes in to but not in from are shown.

TL;DR: The revision range is inverted. You probably want to run git log origin/bugfix/fix1000..bugfix_1000.

Upvotes: 3

Related Questions