My Profile Photo

Rich Werden

Web Developer & Software Engineer


A site for Rich to write about code and show some completed projects for future reference...


#TIL: Earlier Verions of git files

I had a specfic file that I wanted to see an older-than-the-last-commit version of from a specific past commit.

The pattern to do this is git show <treeish>:<filename>

Ex: Show the version of foo.html from four commits ago: (Don’t forget that to go ‘backwards’ from the HEAD [last commit] we use the ~ and not -):

git show HEAD~4:foo.html