Question

I want to generate unified diff with the full function/method context. In ubuntu, when I am using the command: "git log --no-merges -p --function-context", I am getting the following error:

"fatal: unrecognized argument: --function-context".

Is there any work around?

Was it helpful?

Solution

git log --no-merges -p --function-context works just fine with my git 1.8.5 (msysgit on Windows).
This isn't surprising considering that the git log man page does mention:

The command takes options applicable to the git rev-list command to control what is shown and how, and options applicable to the git diff-* commands to control how the changes each commit introduces are shown.

Check the version of your Git: it is possible it doesn't support that argument yet.


That --function-context was introduced with commit 14937c2, by René Scharfe, for git 1.7.8 (December 2011).

Add the option -W/--function-context to git diff.
It is similar to the same option of git grep and expands the context of change hunks so that the whole surrounding function is shown.
This "natural" context can allow changes to be understood better.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top