1
0
mirror of https://github.com/jbranchaud/til synced 2026-01-03 07:08:01 +00:00

Add Review Commits From Before A Certain Date as a Git TIL

This commit is contained in:
jbranchaud
2023-02-15 13:22:44 -06:00
parent 198e40fc01
commit fb79ce1f14
2 changed files with 30 additions and 1 deletions

View File

@@ -10,7 +10,7 @@ pairing with smart people at Hashrocket.
For a steady stream of TILs, [sign up for my newsletter](https://crafty-builder-6996.ck.page/e169c61186).
_1283 TILs and counting..._
_1284 TILs and counting..._
---
@@ -304,6 +304,7 @@ _1283 TILs and counting..._
- [Renaming A Branch](git/renaming-a-branch.md)
- [Resetting A Reset](git/resetting-a-reset.md)
- [Resolve A Merge Conflict From Stash Pop](git/resolve-a-merge-conflict-from-stash-pop.md)
- [Review Commits From Before A Certain Date](git/review-commits-from-before-a-certain-date.md)
- [Run A Git Command From Outside The Repo](git/run-a-git-command-from-outside-the-repo.md)
- [Set A Custom Pager For A Specific Command](git/set-a-custom-pager-for-a-specific-command.md)
- [Shorthand To Force Push A Branch](git/shorthand-to-force-push-a-branch.md)

View File

@@ -0,0 +1,28 @@
# Review Commits From Before A Certain Date
I was recently looking at data in a 3rd-party tool and saw that there was a
very distinct shift in what was being recorded a couple years prior on a
specific date. I wanted to see what changes had been made to the codebase a day
or two before the shift.
Rather than scrolling all the way back in `git log`, I can tell `git log` to
show me all commits from before a certain date.
Let's say that date of interest is May 1st, 2021. I can use the `--until` flag
with `git log`. However, I should note that `--until` is an exclusive range, so
I'll need to specify `May 2 2021` if I want to start seeing commits on May 1.
```bash
$ git log --until='May 2 2021'
```
Because `git log` shows commits in reverse chronological order, I'll start
seeing commits from May 1st and then as I scroll, I'll see older and older
commits.
From here I can scan commits messages and look for one that I want to dig into.
I'd then use `git show <sha>` to explore a specific one further.
This is synonymous with `--before`.
See `man git-log` for more details.