代码之家  ›  专栏  ›  技术社区  ›  slayerIQ

添加后仍未跟踪Git

  •  6
  • slayerIQ  · 技术社区  · 16 年前

    每次我做Git状态,都会有这个文件夹显示为未跟踪。

    $ git status
    # On branch master
    # Untracked files:
    #   (use "git add <file>..." to include in what will be committed)
    #
    #       src/error/
    nothing added to commit but untracked files present (use "git add" to track)
    

    即使在做了之后 git add . , git commit -a src/error处的文件夹一直显示为未跟踪。每次只有这个文件夹出现问题时,其他未分页的文件都会被提交。而且Git不报告任何错误。这里可能有什么问题?

    3 回复  |  直到 16 年前
        1
  •  6
  •   slayerIQ    16 年前

    我发现了问题和解决方案,这就是发生的事情:

    当我在本地更改案例时,第一个src/error被称为src/error,foldername被更改,但在git中,它仍然被提交为src/error。Windows不区分大小写,所以我所做的就是删除文件夹commit,然后用正确的大小写再次添加它。

        2
  •  1
  •   Community Mohan Dere    9 年前

    如果文件夹是空的,那么它是正常的,请参见 here

        3
  •  1
  •   Lernkurve    16 年前

    我在Windows7控制台中尝试了以下操作,但它运行正常,即没有显示 \src\error\ 未追踪的

    C:\t>dir
     Volume in drive C is BLAH
     Volume Serial Number is 2ECA-CB88
    
     Directory of C:\t
    
    10.08.2010  17:56    <DIR>          .
    10.08.2010  17:56    <DIR>          ..
                   0 File(s)              0 bytes
                   2 Dir(s)  59'844'902'912 bytes free
    
    C:\t>mkdir .\src\error
    
    C:\t>copy con: .\src\error\text.txt
    blah^Z
            1 file(s) copied.
    
    C:\t>git init
    Initialized empty Git repository in C:/t/.git/
    
    C:\t>git add .\src\error\*
    
    C:\t>git status
    # On branch master
    #
    # Initial commit
    #
    # Changes to be committed:
    #   (use "git rm --cached <file>..." to unstage)
    #
    #       new file:   src/error/text.txt
    #
    

    这并不能回答你的问题,但我认为这可能有助于看到一个完整的一步一步的例子。