Git GUI on windows not recognizing SQL (.sql) file as text
Apologies if this has been answered already but I have yet been unable to find an answer :(
I'm using SQL Server Management Studio 2008 on Windows 7 box.
I right-click any sproc, function or object and choose "Modify".
I click "Save" and save the file to a folder that is a git repository on my local hard drive. I save the file as suggested type = "Microsoft SQL Server Query File 开发者_StackOverflow(.sql) So now I have a file e.g. "MySproc.sql" which opens fine in SQL Management studio, however when I use Git GUI and do a "scan" to find modified files it presents my new "MySProc.sql" as "* Binary file (not showing content)." instead of simple text.I've tried opening the file in NOtepad and re-saving it but that did not fix it.
Any help would be greatly appreciated.
Just a guess, but I would say your .sql file is UTF-16; If you were to save it as UTF-8 or ASCII, I imagine git gui would work properly with it.
It is annoying, but what I do is change the extension to .txt before uploading changes. I think the .sql extension is what is tripping up git.
P.S. Here's a valuable tip if you are using SQL Server Management Studio. Right click on your database. Choose Tasks from the popup menu and then Generate Scripts. That brings you into a wizard where you can generate scripts for everything in your database. You can output all scripts into a single folder. Then use a program like oscar's renamer to change the extension to .txt before you commit your changes. It is a great way to add source control (albeit manual) to your database.
You can also use powershell to convert the file to ASCII.
Get-Content Filename.sql | Out-File NewFileName.sql -Encoding ascii
精彩评论