Git log with diff for a certain file
Asked Answered
Z

1

14

How can one get log listing combined with the differences in each commit
ie:

commit1  
Author
Date  
Commit message
changes between commit1 and commit2

commit2  
Author
Date
Commit message
changes between commit2 and commit3
...

Using
git log /some/file
Gives a listing of the commits that changed some/file

ie:

commit1  
Author
Date  
Commit message

commit2  
Author
Date
Commit message
...

However, the changes in each commit doesn't get displayed

Using
git diff hash1..hash2 /some/file
Gives the changes in /some/file between those two commits.
But only between those 2 commits, not through all the commits that changed /some/file

Zygo answered 28/7, 2016 at 12:16 Comment(0)
L
24

According to https://git-scm.com/docs/git-log you can use

git log -p path 
to show commits that touch the specified paths, and diffs about the same specified paths.
Leoni answered 28/7, 2016 at 12:24 Comment(2)
Thanks. Maybe we can integrate that -p is the short version of --patch. But the edit queue is full now.Urbanize
Also the manual link could be this that points to the relevant section: git-scm.com/docs/git-log#generate_patch_text_with_pUrbanize

© 2022 - 2024 — McMap. All rights reserved.