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/

相关文章:

windows - Git for Windows "No tags file"来自 "git diff"命令的响应

git - merge 后是否应该删除分支?

git - "Complicated"Git 中的 merge 场景

git - 如何将 SourceTree 中的分支移动到文件夹中?

git - 如何忽略 Git 中的现有文件?

Azure 上的 Git 使用常见工具(例如 SourceTree)

git - 干净的工作树下 `git branch -f <branch_name> <hash>` 和 `git checkout <branch_name>; git reset --hard <hash>` 之间的区别?

python - 是否可以将 Python 项目的 "venv"文件夹发布到我的 GIT 存储库中?

Git 预提交 Hook : changed/added files

atlassian-sourcetree - SourceTree 不会显示我的所有更改