Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there something similar to diff --show-c-function in git-diff?

Tags:

git-diff

diff

I've been working on a file in my git repository. If I have a copy of the original git version of the file, I can run diff --show-c-function to get a comparison of the 2, files, where (in theory) it shows the whole of any function which has been changed. This is really useful for working out what I did specifically to a file, in working out the comment I'd need.

However in git-diff, this option is missing. Is there some way to make this work (or am I stuck having to get 2 copies of the file before I can commit, where the git-diff response is slightly complicated)?

like image 264
Simon Bazley Avatar asked May 13 '13 15:05

Simon Bazley


1 Answers

git help diff shows this option:

-W, --function-context
        Show whole surrounding functions of changes.

So, it looks like git diff -W should do what you want.

like image 146
twalberg Avatar answered Nov 05 '22 08:11

twalberg