相关疑难解决方法(0)

git line endings - 无法存储,重置,现在无法通过虚假行结尾提交

我有一个回购我添加了gitattributes它并正在努力它.我通过Dropbox将它同步到另一台机器.当我把它打开到另一台机器时,一堆文件突然出现在未分区的区域作为总差异(所有文件都是一个巨大的差异,这意味着行结束差异) - 我的crlf结局基本上是.* text=auto我在Windows上工作.我试图隐藏更改,重置分支等.最后我决定提交文件然后做了一些其他提交我想在行结束提交之前重新排序(和压缩).当我尝试变基时,我得到一个:

error: Your local changes to the following files would be overwritten by merge
        # those same files
Please, commit your changes or stash them before you can merge.
Aborting
Could not apply 89b25b81fff1a1e7893319e123aaaca9c4162a95... <commit message>
Run Code Online (Sandbox Code Playgroud)

当然藏匿不起作用

这是一个错误吗?

有关:

编辑与机器无关 - 在同一台机器上,一些(......)操作只是使这些文件(它们在.gitattributes文本中)出现在"已更改"部分.似乎存在的唯一解决方法是:

git rm --cached -r .
git reset --hard
Run Code Online (Sandbox Code Playgroud)

小心使用

编辑:hack上面转移到别名状态:

[alias]
     crlf = !git rm -r . …
Run Code Online (Sandbox Code Playgroud)

git line-endings

28
推荐指数
1
解决办法
5880
查看次数

使用autocrlf = false的Git仍然会产生"警告:CRLF将被LF替换"消息

我在Ubuntu 14.04上使用Git版本1.9.1.

我已经core.autocrlf在一个带有DOS格式和Unix格式文件的新repo中测试了这种行为,并确认git add使用autocrlf=truedo,正如预期的那样,LF will be replaced by CRLF in ...为Unix格式文件生成一条警告:消息,并且在任何文件时都不生成消息autocrlf=false.(在这种情况下,我不清楚为什么它决定在回购中使用DOS行结尾而不是Unix行,但我不确定这在哪里很重要.)

然而,在另一个回购中,尽管有autocrlf=true,它一直告诉我它将转换一些文件:

$ git config core.autocrlf
false
$ git add lib/node_modules/pulp/node_modules/webpack/node_modules/webpack-core/node_modules/source-list-map/test/fixtures/from-to-tests/null-source.input.map
warning: CRLF will be replaced by LF in lib/node_modules/pulp/node_modules/webpack/node_modules/webpack-core/node_modules/source-list-map/test/fixtures/from-to-tests/null-source.input.map.
The file will have its original line endings in your working directory.
$
Run Code Online (Sandbox Code Playgroud)

我无法弄清楚为什么这样做.我正在寻找问题的解释或如何调试它的线索.

补充说明:

  • 不,.gitattributes回购中没有文件.但它提出了一个有趣的观点,如果autocrlf设置为false会有所不同吗?
  • 不,我只是仔细检查,文件在每个0x0d后有一个0x0a,在每个0x0a之前有一个0x0d.

git core.autocrlf

5
推荐指数
1
解决办法
1100
查看次数

标签 统计

git ×2

core.autocrlf ×1

line-endings ×1