How to diff a file at a certain time in the past

This is part of the Semicolon&Sons Code Diary - consisting of lessons learned on the job. You're in the git category.

Last Updated: 2024-11-23

What is the syntax to do a git diff of a file/folder as it was a certain time ago (e.g. to see how it was progressed since you last touched it)

git diff HEAD 'HEAD@{1 day ago}' -- app/views/layouts

Notice then syntax for the period in the past: 'HEAD@{x days ago with no words}' - it is an @{} structure - it uses white space between the words - it wraps the whole thing within quotes.

Then we use the standard filter to a particular file -- path/to/file