为什么Source Tree不是Git Diff的Powershell脚本(ps1)

问题描述 投票:2回答:2

我在Windows上使用SourceTree作为我的git客户端(v1.8.3.0)。出于某种原因,它没有显示我的PowerShell脚本(diff)的.ps1,而是将其显示为二进制文件:

enter image description here

我需要切换设置才能获得正确的行为吗?如果我将文件重命名为.txt而不是diff按预期工作。

我在我的仓库中有一个.gitattributes文件,我已经更新它以明确说明.ps1文件,但这似乎也不起作用:

*.ps1   diff=astextplain
*.PS1   diff=astextplain

或者,我可以看到qazxsw poi就好了,我去了qazxsw poi(通过Beyond Compare),但是,这并没有帮助我根据特定的行号进行提交:

diff

git powershell atlassian-sourcetree
2个回答
3
投票

看起来这是Atlassian产品(BitBucket,SourceTree)的一个已知问题:External Diff

问题是我的enter image description here文件被保存为UTF16 Unicode。将其更改为https://bitbucket.org/site/master/issues/5453/powershell-module-manifest-file-psd1-are.ps1修复此问题,我再次在SourceTree中获取UTF8s。


1
投票

你可以做(​​最近只有git!)

ascii

(如果用bom等删除LE)

这在你的diff文件中

© www.soinside.com 2019 - 2024. All rights reserved.