Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I view previous diff commits using Git?

Tags:

git

diff

How do I view previous diff commits using Git?

I have a file that I've made several commits on, but I want to view previous versions of the file AND its diff's at different stages. Seeing where I made mistakes and how I fixed them is really helping my code. By the way, I'm using Tower as a GUI on top of Git.

like image 666
lampShade Avatar asked May 05 '11 16:05

lampShade


3 Answers

git log --full-diff -p your_file_path

Check out:
http://git-scm.com/docs/git-log

like image 158
Ahmish Avatar answered Nov 13 '22 06:11

Ahmish


You need git log. If you were interested in file SOMEFILE use

$ git log -p SOMEFILE

The -p option displays the patch which is probably the diff you are looking for.

like image 32
Benjamin Bannier Avatar answered Nov 13 '22 06:11

Benjamin Bannier


If you don't want to specify a particular file, and see the diff for all files changed, just use

$ git log -p
like image 37
Sparhawk Avatar answered Nov 13 '22 08:11

Sparhawk