简体   繁体   English

新克隆的 git 存储库显示有本地更改

[英]Freshly cloned git repositories displays there are local changes

I can't quite get my head around, why a freshly cloned git repository shows that there are changes not stagged for commit.我不太明白,为什么新克隆的 git 存储库显示有更改未提交提交。

Here is a short example:这是一个简短的例子:

    [dpetrov@macbook-pro ~/work]$ git clone /tmp/git/pollers.git pollers
    Cloning into 'pollers'...
    done.
    [dpetrov@macbook-pro ~/work]$ cd pollers/
    [dpetrov@macbook-pro ~/work/pollers (master)]$ git status
    On branch master
    Your branch is up-to-date with 'origin/master'.

    nothing to commit, working tree clean
    [dpetrov@macbook-pro ~/work/pollers (master)]$ git checkout pollers-1.0
    gBranch pollers-1.0 set up to track remote branch pollers-1.0 from origin.
    Switched to a new branch 'pollers-1.0'
    i
    [dpetrov@macbook-pro ~/work/pollers (pollers-1.0)]$ git status
    On branch pollers-1.0
    Your branch is up-to-date with 'origin/pollers-1.0'.

    Changes not staged for commit:
      (use "git add <file>..." to update what will be committed)
      (use "git checkout -- <file>..." to discard changes in working directory)

        modified:   share/mibs/IANAifType-MIB.mib

    no changes added to commit (use "git add" and/or "git commit -a")
    [dpetrov@macbook-pro ~/work/pollers (pollers-1.0)]$ git diff share/mibs/IANAifType-MIB.mib
    diff --git a/share/mibs/IANAifType-MIB.mib b/share/mibs/IANAifType-MIB.mib
    old mode 100644
    new mode 100755
    index 3b4added..14da8028
    --- a/share/mibs/IANAifType-MIB.mib
    +++ b/share/mibs/IANAifType-MIB.mib
    @@ -1,13 +1,11 @@
    --- Extracted from http://www.iana.org/assignments/ianaiftype-mib
    ---
    -   IANAifType-MIB DEFINITIONS ::= BEGIN
    +IANAifType-MIB DEFINITIONS ::= BEGIN^M

   IMPORTS
        MODULE-IDENTITY, mib-2      FROM SNMPv2-SMI
        TEXTUAL-CONVENTION          FROM SNMPv2-TC;

    ianaifType MODULE-IDENTITY
-       LAST-UPDATED "200505270000Z"  -- May 27, 2005
+       LAST-UPDATED "200411220000Z"  -- June 17, 2004^M
        ORGANIZATION "IANA"
        CONTACT-INFO "        Internet Assigned Numbers Authority

Any clues how to debug that and what might be causing it?任何线索如何调试以及可能导致它的原因是什么?

Thanks so much.非常感谢。

It was a case sensitivity issue in the file names : two different files, with only difference in casing in their names, were stored in git.这是文件名中区分大小写的问题:两个不同的文件存储在 git 中,它们的名称只有大小写不同。

When checking the differences, git would receive the "wrong" content for one of the two names.检查差异时,git 会收到两个名称之一的“错误”内容。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM