代码之家  ›  专栏  ›  技术社区  ›  Ionuț G. Stan

git状态报告在新克隆的repo中修改的文件

  •  4
  • Ionuț G. Stan  · 技术社区  · 16 年前

    解决了的

    似乎远程repo包含两个名称相同的文件,除了第一个字母。这在我的系统上导致了一个文件覆盖,这导致了下面的问题。

    这似乎与新词无关,但我还找不到解释。事情是这样的。

    git status 报告 FileStartingWithCapitalLetter.php 已修改

    另一方面,浏览我的不区分大小写的文件系统时,会显示fileStartingWithCapitalLetter.php,它实际上是以小写“f”开头的。

    git diff FileStartingWithCapitalLetter.php

    diff --git a/test/functional/frontend/RedirectActionsTest.php b/test/functional/frontend/RedirectActionsTest.php
    index 66e1fef..c574583 100644
    --- a/test/functional/frontend/RedirectActionsTest.php
    +++ b/test/functional/frontend/RedirectActionsTest.php
    @@ -5,10 +5,10 @@ include(dirname(__FILE__).'/../../bootstrap/functional.php');
     $browser = new sfTestFunctional(new sfBrowser());
     
     $browser->
    -  get('/Redirect/index')->
    +  get('/redirect/index')->
     
       with('request')->begin()->
    -    isParameter('module', 'Redirect')->
    +    isParameter('module', 'redirect')->
         isParameter('action', 'index')->
       end()->
    

    另一方面, git diff fileStartingWithCapitalLetter.php(小写f)没有显示任何更改。

    有什么办法?

    老问题

    我克隆了一个git回购,然后立即执行 git状态 . 看到它报告修改过的文件并不奇怪,就像以前发生在我身上一样。有从Windows机器提交的CRLF行结束(我在osx上)。

    $ git config core.autocrlf false
    $ rm .git/index
    $ git reset
    Unstaged changes after reset:
    M  test/functional/frontend/RedirectActionsTest.php
    

    有人知道哪里出了问题,怎么解决吗?我使用的是git1.7.0.2。

    1 回复  |  直到 6 年前
        1
  •  3
  •   Community Mohan Dere    9 年前

    global level (注: I also like having it set to false )

    $ git config --global core.autocrlf false
    

    然后再克隆一次看看效果是否更好。

    ignorecase true (也是在全球层面上设定的)。
    看到这个了吗 SO question 例如 this one

    推荐文章