本文介绍了Git将未修改的文件标记为由LESS生成时修改或者行分隔符已更改的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个使用git的问题。

I have an issue using git.

它基本上标记了两种不同情况下未修改的文件:

It basically flag files that haven't modified in two different cases:


  • 当我的LESS文件观察器重新生成文件时(原因不明),内容没有改变,与以前完全一样。

  • 当lne分隔符发生变化时,由于LESS始终对生成的.css使用LF,无论源文件的行分隔符是多少($)。
  • When the file has been regenerated by my LESS file watcher (for unknown reason), the content hasn't changed, it is exactly the same as before.
  • When the lne separator has changed, because LESS use always LF for generated .css, whatever the line separator of the source file (less) is.

我添加了。

我不明白为什么这些文件被标记为已修改,它混淆了我的git,因为它不能提交它们。这是无聊和经常性在我的项目。

I don't understand why these files are flag as modified, it messes up my git because it cannot commit them. It's boring and recurrent in my projects.

这是我得到一个 git状态命令行:

Here is what I get with a git status command line:

    updated :         assets/linker/styles/common/alignment.css
    updated :         assets/linker/styles/common/badges.css
    updated :         assets/linker/styles/common/base.css
    updated :         assets/linker/styles/common/buttons.css
    updated :         assets/linker/styles/common/datatables.css
    updated :         assets/linker/styles/common/float.css
    updated :         assets/linker/styles/common/forms.css
    updated :         assets/linker/styles/common/panels.css
    updated :         assets/linker/styles/common/text.css
    updated :         assets/linker/styles/devices/layouts/devices_default.css
    updated :         assets/linker/styles/layouts/default.css
    updated :         assets/linker/styles/themes/ayolan.css
    updated :         assets/linker/styles/views/chart.css
    updated :         assets/linker/styles/views/home.css

任何解决方法?

推荐答案

如何让git忽略行尾?

How about telling git to ignore line endings?

git config core.autocrlf true

并将您的.gitattributes设置在您的项目根目录中

and set your .gitattributes in your project root to

*.css text eol=lf

请参阅或以获取更多信息。

See gitattributes doc or dealing with line endings for more information.

这篇关于Git将未修改的文件标记为由LESS生成时修改或者行分隔符已更改的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-06 03:34