Making git diff (NOT difftool) and git log -p work with *.sql files and Windows PowerShell
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).
Take a look at git attributes. You can customize how certain files are handled by diff and other aspects.
How this helps
精彩评论