2

I know how to configure an external tool to view differences with a call to git difftool. However, if I want to see an 'dump' of all changes for entire history of a file to my console window, I wanted to use git log -p <filename>. The problem I'm having is with *.sql files in my Windows environment. difftool (using my my configured tool) correctly handles the unicode file, however diff does not, which is what I think git log -p uses under the hood.

Is there a way to make git diff 'work' with files of a given/configured extension where I know there is truly only ANSI characters and show actual text changes outputted to the console (in my case Windows PowerShell hosted inside Console).

Note: I've looked at this question/answer about making git diff recognize UTF16, but I couldn't get it to work (both iconv and mktemp were not present on my system).

Maybe this is the approach I should continue to examine/experiment with as the only possible solution? Or is my only solution is to ensure files where I know only ANSI characters are present are saved as ANSI - would be disappointing to lose all the history I currently have on *.sql files (and any other files I'm not aware of that are stored as unicode right now - I'm a newly converted git user from Visual SourceSafe, so haven't had to view differences on all my file types that I modify yet).

Community
  • 1
  • 1
Terry
  • 2,148
  • 2
  • 32
  • 53

1 Answers1

1

Take a look at git attributes. You can customize how certain files are handled by diff and other aspects.

How this helps

Adam Dymitruk
  • 124,556
  • 26
  • 146
  • 141
  • So I've added a .gitattributes file with `*.sql diff=strings`. Then I downloaded Strings.exe from [here](http://technet.microsoft.com/en-us/sysinternals/bb897439). Then I added the following to my .gitconfig: `[diff "strings"] textconv = "C:/BTR/PowerToys/SysInternals/strings.exe" cachetextconv = true` Yet, when I do a git diff on a *.sql file, I get: `diff --git a/path/to/*.sql b/path/to/*.sql index .. 100644 Binary files a/path/to/*.sql and b/path/to/*.sql differ` Any ideas? – Terry May 11 '11 at 08:37
  • Forgot to notify you with @...I assume I need to do that for you to get an email? Wish I could get line feeds in my previous comment :( Hopefully you can decipher what I wrote. – Terry May 11 '11 at 08:44