1

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?

1 Answer 1

1

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.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.