Location Pin 1 Streamline Icon: https://streamlinehq.com applied cartography

Git one-liner: get the earliest commit from X hours ago

I wanted to get a commit that was temporally some distance back as part of my experimentation with git cliff. This took some time to do, but here's what I ended up with:

git log  --since="72 hours ago" --until="now" --reverse --pretty=format:"%h" | head -1

Nothing particularly fancy, but I hope it's useful!


About the Author

I'm Justin Duke — a software engineer, writer, and founder. I currently work as the CEO of Buttondown, the best way to start and grow your newsletter, and as a partner at Third South Capital.