Log commits added to master in last 24 hours Log commits added to master in last 24 hours git git

Log commits added to master in last 24 hours


I think rev-list is what you want.

Try this:

git rev-list --no-merges '^<24-hour-old-commit>' HEAD

That should list all the non-merge commits that are reachable from commit HEAD, but not reachable from from commit <24-hour-old-commit>.

For example, in this revision graph, it'll list the upper case commits, but not lower case:

a - b - c - 24h - H - i - J - K - HEAD     \               /      D - E - F - G '

Commits H, J, K, and HEAD are all younger than 24 hours old. Commit i is also younger, but is omitted as it is a merge commit. Commits D, E, F, and G may be any age, but have only been merged within the last 24 hours, so they are listed also.


Within the above command, --max-age or --since options will have the same problem as you have with git log, but they can be used to find <24-hour-old-commit> for you:

git rev-list -n1 --before="24 hours" --first-parent HEAD

That is, "give only 1 commit ID, that must be at least 24 hours old, and is on the current branch".

Putting it all together:

git rev-list --no-merges HEAD \             --not $(git rev-list -n1 --before="24 hours" --first-parent HEAD)

(Note: --not abcdef is another way to say ^abcdef except that it applies to all following arguments, hence reordering the options.)

The default output of rev-list is just raw revisions, but you can make it more like git log using the --pretty option. --pretty=short is approximately the same as you're used to.