简体   繁体   English

Git:在根级别“什么也没提交”,但是未修改的文件在子文件夹中显示为已修改

[英]Git: “nothing to commit” at root level, but unmodified files shown as modified in subfolder

I have a strange problem with git. 我对git有一个奇怪的问题。 My folder structure is (simplified) like this: 我的文件夹结构如下所示(简化):

  /wte/
  /wte/bib
  /wte/MATLAB
  /wte/MATLAB/lib
  /wte/MATLAB/simdp

These folders (apart the first two) all contain files. 这些文件夹(前两个除外)均包含文件。

Now if I do git status in /wte/ : 现在,如果我在/wte/执行git status

$ git st
# On branch master
# Your branch is ahead of 'origin/master' by 4 commits.
#
nothing to commit (working directory clean)

But if I do git status in /wte/MATLAB/ (or /wte/bib/ ): 但是如果我在/wte/MATLAB/ (或/wte/bib/ )中执行git status

$ git st
# On branch master
# Your branch is ahead of 'origin/master' by 4 commits.
#
# 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:   ../MATLAB/lib/XSteam_Matlab_v2.6/X Steam for Matlab.pdf
#       modified:   ../MATLAB/lib/XSteam_Matlab_v2.6/XSteam.m
#       modified:   ../MATLAB/lib/XSteam_Matlab_v2.6/XSteamUS.m
#       modified:   ../MATLAB/simdp/extract_mdp_parallel.m
#       modified:   ../MATLAB/simdp/get_virgin_source_states.m
#       modified:   ../MATLAB/simdp/proj.sublime-project
#       modified:   ../MATLAB/simdp/proj.sublime-workspace
#       modified:   ../MATLAB/simdp/tests/T_get_virgin_source_states.m
#       modified:   ../MATLAB/simdp/tests/run_tests.m
#
no changes added to commit (use "git add" and/or "git commit -a")

These file have not been modified: 这些文件尚未修改:

ost@d-win-1 ~/ba/wte/MATLAB
$ git diff simdp/get_virgin_source_states.m 

ost@d-win-1 ~/ba/wte/MATLAB
$ git diff simdp/extract_mdp_parallel.m 

ost@d-win-1 ~/ba/wte/MATLAB
$ git diff lib/XSteam_Matlab_v2.6/XSteam.m 

So what is going on here? 那么这是怎么回事? Any ideas? 有任何想法吗?

Note that these are not all the files, just some of them... 请注意,这些文件不是全部​​,只是其中的一部分...

Thanks! 谢谢!

System: 系统:

  • Windows 7 (64 bit) Windows 7(64位)
  • Git 1.7.5.1 Git 1.7.5.1
  • Cygwin 西格温

Install normal git from http://git-scm.com/download/win . http://git-scm.com/download/win安装普通的git。

I had the same problem, so I just removed cygwin's git and installed a normal one and the problem disappeared. 我遇到了同样的问题,因此我删除了cygwin的git并安装了一个普通的git,问题消失了。

I think the difference is in file-mode. 我认为区别在于文件模式。 For Windows you should try git config --global core.fileMode false . 对于Windows,您应该尝试git config --global core.fileMode false More info here . 更多信息在这里

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

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