1

Based on this question / answers How to list commits since certain commit? I want to get commits from specific <commit-hash>, including this <commit-hash> commit.

Using this command:

git log <commit-hash>^..HEAD --pretty=oneline

I get result with <commit-hash> not being the last line of the output.

What can be reason of this?

mrgloom
  • 20,061
  • 36
  • 171
  • 301

2 Answers2

2

Asking for --boundary commits will often do what you want,

git log --oneline --graph --boundary master..

will show the base commit, only problem is it'll show any merge boundaries too so in more active projects it becomes less useful for visualization (but it gets great for setting up e.g. bisect boundaries).

Tops on my idle-wishlist enhancements for git's rev-list-based commands is a --boundary-first or something option to show boundary commits but only if they're found via first-parent links.

edit: add --graph to your log display to see more about how git log found what it's listing.

jthill
  • 55,082
  • 5
  • 77
  • 137
1

Because the parent revision of <commit-hash> is the direct parent of multiple children that need to be listed in the output and one of them happens to outsort (for lack of a better word) the one you are working from. Check if that is the the case by checking the parents of the other unexpected revision that is listed there.

eftshift0
  • 26,375
  • 3
  • 36
  • 60