1
$ git log --oneline
05f1c3b master: Modified 1.txt
f7433e0 Updated by master
e30dff9 Modified 1.txt
82ebf7a Modified 1.txt
cbb2785 master: Added 4.txt after rebase branch was created
980a5d6 b1: Added 1.txt
badc046 Resolved merge conflict
47a2d78 Mods by b2
c3eb61e Added by b1
9378e3d 1ST commit

The following shows nothing:

$ git log ^47a2d78

I thought it should show all commits from badc046 up, since these are not reachable from 47a2d78.

What am I missing?

Tunaki
  • 132,869
  • 46
  • 340
  • 423
Ltf4an
  • 787
  • 5
  • 18

2 Answers2

4

^hash means "Exclude commits that are reachable from (i.e. ancestors of) ."

Therefore:

git log ^47a2d78

translates to "show log for all commits excluded by hash 47a2d78". This doesn't match any commits. If you want to show all commits after 47a2d78 you must use log ^47a2d78 HEAD, or, more easily:

git log 47a2d78..HEAD
knittl
  • 246,190
  • 53
  • 318
  • 364
  • Cue the usual links to "positive refs" and "negative refs" (http://stackoverflow.com/a/850695/6309), and revision lists (http://stackoverflow.com/a/53573/6309). +1 – VonC Jun 20 '15 at 18:12
  • Now that you confirmed it returns nothing, I realized that I misinterpreted the behavior, or rather expected git to "read my mind;" by law of negation, I'd thought git would be able to imply that I wanted to see commits NOT reachable from 47a2d78. Obviously, that is not possible since I did not specify that. – Ltf4an Jun 21 '15 at 10:51
-1

If you want a log over a range of commits you can do:

git log HEAD...47a2d78
Sébastien Dawans
  • 4,537
  • 1
  • 20
  • 29