Skip to content

Difference between now and one, two, three, etc. commits ago

April 19, 2013

Its been a while since I’ve made a purely technical post. Here’s one that I just don’t want to forget.

Often I want to see how a file is different from say three git commits ago. This stackoverflow gives me exactly want I want. To summarize, here’s how you can get these diffs from a terminal for one, two, three, and four commits ago:
git diff HEAD~1 file
git diff HEAD~2 file
git diff HEAD~3 file
git diff HEAD~4 file

Advertisements
No comments yet

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: