2

When you run pull command (and if it succeeds) it shows you something like this:

984ed83..af3ad3c master -> origin/master

and then I usually run git lg which is my alias I set for

log --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit

this shows the log in "easy to read" way. Although I still need to scan the log with my eyes and find the first hash and then read everything upward from that point.

enter image description here

Now I'm wondering if it's possible, after a successful pull to see log but only from the last changed hash up to the head?

fracz
  • 20,536
  • 18
  • 103
  • 149
iLemming
  • 34,477
  • 60
  • 195
  • 309
  • you can write a client side hook – hjpotter92 Aug 18 '16 at 05:50
  • What about `git lg 984ed83..af3ad3c`? – fracz Aug 18 '16 at 05:55
  • @franz you still have to do it "manually". Is there a "smarter" way, something like `git log ~last_pull..HEAD` – iLemming Aug 18 '16 at 05:59
  • Try `git log master@{1}..master` or `git log HEAD@{1}..HEAD` depending on what do you want to see. Have you seen [this](http://stackoverflow.com/a/1362990/878514)? – fracz Aug 18 '16 at 06:01
  • ummm this is interesting. so what exactly `@{1}` means here? apparently it works. Although `HEAD@{1}..HEAD` didn't work for repo where I'm not in the master branch – iLemming Aug 18 '16 at 06:05
  • 1
    `@{1}` refers to the second entry in the *reflog* (`git reflog`). That log is updated essentially whenever HEAD changes, so it *can* be used for looking at how the branches looked in past. But just using `@{1}` is not a safe way to refer to the commit before the merge here. – poke Aug 18 '16 at 06:21
  • what about `ORIG_HEAD..HEAD`, can I use that? – iLemming Aug 18 '16 at 06:25
  • 1
    Yeah, that should work. – poke Aug 18 '16 at 06:48

0 Answers0