ThorSummoner
ThorSummoner

Reputation: 18169

Git - How to get the first commit sha1 on a given date

I want the first sha1 after 00:00:01 hours on a given date, or if there were no commits on that day: the newest commit number before 00:00:01 hours of that date.

I only want results that are on (merged into) the trunk aka master branch.

Upvotes: 2

Views: 737

Answers (1)

ThorSummoner
ThorSummoner

Reputation: 18169

git rev-list -n1 --before="2014/2/27" master

I found out about this command here: How can I get the diff between all the commits that occurred between two dates with Git?

Turns out what I really wanted to see the diff between two dates and this command was a stepping stone on the way there, found my answer in the previous link.

Upvotes: 2

Related Questions