git - SourceTree 不尊重 .gitattributes 文件

标签 git atlassian-sourcetree

我已经设置了 .gitattributes 的内容文件在我的 项目的根对此:

members/2/dist/** text eol=LF
members/2/contacts/details/view/health/build/** text eol=LF

members/2/framework/cr.compressed-paths.js text eol=LF
members/2/framework/cr.loaderConfig.js text eol=LF

嵌套在 dist/和 health/build 路径下的文件应该以 LF 结尾存储。这些文件都是从各种 Windows 进程自动生成的,这就是(似乎)要使用的。当然,我的项目根目录下有一个成员文件。

运行上述过程后,我看到这两个目录下的待处理更改,但 SourceTree 中没有显示任何可见更改。尝试提交会产生此错误:
warning: LF will be replaced by CRLF in members/2/contacts/details/view/health/build/allergy-component-bundle.js. The file will have its original line endings in your working directory.
我的 .gitattributes 文件是否设置错误?当 .gitattributes 说使用 LF 时,为什么 SourceTree 试图转换回 CRLF?

我还会注意到,切换到 tortoiseGit 会显示这些相同的文件已更改,因此问题似乎出在我的 git 配置上,而不是 SourceTree。

最佳答案

似乎解决这个问题的最好方法就是像这样关闭规范化

members/2/dist/** -text
members/2/contacts/details/view/health/build/** -text

members/2/framework/cr.compressed-paths.js -text
members/2/framework/cr.loaderConfig.js -text

关于git - SourceTree 不尊重 .gitattributes 文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32383554/

相关文章:

git - git for-each-ref 的 --format 选项的有效字段是什么?

git - Sourcetree 在全局 .gitignore 中添加文件,而不是在存储库 .gitignore 中

Git 更改与远程 merge 后丢失的文件(SourceTree,GitHub)

git - 为什么在 git reset (--mixed) 之前显式调用 git reset --soft

git - SourceTree 中的 IntelliJ 差异工具

windows - Windows 上的 SourceTree : How to connect to SSH?

git - git 身份验证的应用程序密码(bitbucket 和 sourcetree)

git - 从 Bitbucket 部署到 Digital Ocean - 权限被拒绝(公钥)错误

Git:仅可视化 "tags"

git - 为什么我的 Git 远程 URL 只需要在某些系统上包含我的用户名?