Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I do case insensitive git diffing while also doing `git diff --color`?

Is it possible to do a case insensitive git diff while also doing git diff --color-words? Or do I need to use an external diff program while doing git diff --color-words?

( note: if all you want is git diff case insensitive please go to this question How to perform case insensitive diff in Git )

like image 577
Andrew Grimm Avatar asked Feb 14 '11 23:02

Andrew Grimm


People also ask

How does git diff change if you add the -- color words option to the command?

git diff --color-words git diff also has a special mode for highlighting changes with much better granularity: ‐‐color-words . This mode tokenizes added and removed lines by whitespace and then diffs those. Now the output displays only the color-coded words that have changed.

What does M mean in git diff?

^M represents carriage return. This diff means something removed a Unicode BOM from the beginning of the line and added a CR at the end.

What is M in git status?

Now, It is showing changes to be committed which means the file is now included and ready to commit. We can commit files using the git commit -m “message” command. Output: After committing, the status is now changed to nothing to commit because now the working tree is clean.


1 Answers

GIT_EXTERNAL_DIFF='diff -ipu "$2" "$5" #' git diff --ext-diff

Or, in a nicer fashion without the # hack I used there:

echo 'diff -ipu "$2" "$5"' >myscript; chmod a+x myscript;
GIT_EXTERNAL_DIFF='./myscript' git diff --ext-diff

I agree it would be nicest if git-diff would just have an -i option...

like image 174
user611775 Avatar answered Nov 02 '22 06:11

user611775