I'm using SourceTree as my git client on Windows (v1.8.3.0). For some reason it's not showing a diff of my PowerShell script (.ps1) and instead shows it as a binary:

Is there a setting I need to toggle to get correct behavior? If I rename the file to be a .txt than the diff works as expected.
I have a .gitattributes file in my repo, and I've updated it to explicitly account for .ps1 files, but that doesn't seem to work either:
*.ps1 diff=astextplain
*.PS1 diff=astextplain
Alternatively, I can see the diff just fine in I goto External Diff (via BeyondCompare), however, this doesn't help me craft a commit based of specific line numbers:

It looks like this is a known issue with Atlassian products (BitBucket, SourceTree): https://bitbucket.org/site/master/issues/5453/powershell-module-manifest-file-psd1-are
The issue is my .ps1 file was saved as UTF16 Unicode. Changing it to UTF8 or ascii fixes this and I get diffs inside of SourceTree again.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With