Search code examples
gitgit-diff

Git diff on multiple line variable


I want to make a git diff between two different revisions of my code. What is bothering me is the a problem with multi line variable.

Eg.

MyVariable= "some_data_here="some_value"; another_data_here \
             more_data_here \
             "

When I run:

git diff some_commit_sha^! -- repo_name | grep some_data_here

The same thing happens without pipe grep.

git diff some_commit_sha^! -- repo_name

My expectation is to obtain

MyVariable= "some_data_here="some_value"; another_data_here \
             more_data_here \
             "

Real result are

MyVariable= "some_data_here="some_val more_data_here \"

How can I make a git diff agains a variable with multiple lines ?

Any help will be appreciated.


Solution

  • git diff -U 9999 <othercommit> -- filename

    Thank you @LeGEC.