Hacker Newsnew | past | comments | ask | show | jobs | submitlogin
Ask HN: Is there something like “today X years ago” but for Git?
2 points by whoibrar on Aug 20, 2022 | hide | past | favorite | 4 comments
Google photos has something called memories [0], which shows the photos taken on a today's date but from x years ago. So, today photos from 20-Aug-2011, 20-Aug-2015, 20-Aug-2020 all show up at one place.

Since, git as a Version control system tracks changes as tiny as single character. I was wondering if there was something where I could enter a date and it will show me how the repository looked like on that particular day, or even better show how file(s) has changed in weeks, months, years and probably decades.

[0] : https://techcrunch.com/2015/08/20/google-photos-introduces-rediscover-this-day-to-help-you-reminisce/



Are you looking for git checkout 'main@{1 year ago}'

See also https://git-scm.com/docs/git-rev-parse, that works with all kinds of git subcommands.

BTW, git doesn't track every change, only when you add the change.


A fun thing is that the full gitrevisions syntax used by `rev-parse` is supported many places on GitHub where you would normally put an object id or ref name.

For example, https://github.com/git/git/tree/master@{5.years.ago}

Note that this uses the reflog which means that it won’t work in some situations (branch renames, entries rolled off the end of the log, etc)


For a single file you can use `git log` to show you all patches that changed the file, going back in history forever:

  git log --follow --patch -- some/file
It composes with Tomte's @{1 year ago} tip if you want to start reading at a particular point in time:

  git log --follow --patch 'main@{1 year ago}' -- some/file
ref: https://git-scm.com/docs/git-log


There is https://retrogit.com/ that sends you emails on what happened in repositories on this day, similar to memories.




Consider applying for YC's Winter 2026 batch! Applications are open till Nov 10

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: