2013-05-14 45 views
0

我在这里有一个有趣的发生。我已经开发了一段时间(在Windows上开发,文件被移动到Linux VM,提交来自VM)并创建了许多新文件。当我运行git status时,它会显示new file:部分和modified:部分中的所有新文件。git Status在新的和修改部分中显示文件

这里是git status结果:出现在修改后的部分(除build.xml)出现在新的部分

# On branch 2.x-merge 
# Your branch is ahead of 'composer/2.x-merge' by 1 commit. 
# 
# Changes to be committed: 
# (use "git reset HEAD <file>..." to unstage) 
# 
#  new file: SP/ElasticSearch/ElasticSearch.php 
#  new file: SP/ElasticSearch/Filters/AndFilter.php 
#  new file: SP/ElasticSearch/Filters/Boolean.php 
#  new file: SP/ElasticSearch/Filters/OrFilter.php 
#  new file: SP/ElasticSearch/Queries/Boolean.php 
#  new file: SP/ElasticSearch/Queries/Filtered.php 
#  new file: SP/ElasticSearch/Queries/Match.php 
#  new file: SP/ElasticSearch/Queries/MatchAll.php 
#  new file: SP/ElasticSearch/Queries/Term.php 
#  new file: SP/ElasticSearch/esFilter.php 
#  new file: SP/ElasticSearch/esInserter.php 
#  new file: SP/ElasticSearch/esQuery.php 
#  new file: SP/ElasticSearch/esQueryBuilder.php 
#  new file: tests/SP/ElasticSearch/ESTest.php 
#  new file: tests/SP/ElasticSearch/esFilterTest.php 
#  new file: tests/SP/ElasticSearch/esQueryTest.php 
# 
# 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: SP/ElasticSearch/ElasticSearch.php 
#  modified: SP/ElasticSearch/Filters/Boolean.php 
#  modified: SP/ElasticSearch/Filters/OrFilter.php 
#  modified: SP/ElasticSearch/Queries/Boolean.php 
#  modified: SP/ElasticSearch/esFilter.php 
#  modified: SP/ElasticSearch/esQuery.php 
#  modified: SP/ElasticSearch/esQueryBuilder.php 
#  modified: build.xml 
#  modified: tests/SP/ElasticSearch/ESTest.php 
#  modified: tests/SP/ElasticSearch/esQueryTest.php 
# 

如果你会发现,一切,这些都是新的文件,所以他们应该。

提交进展良好,我只是做了一个-am,没有问题,我只是想知道是否有人知道为什么会发生这种情况,它的意思,或者它是如何发生的。

在此先感谢。

+0

自从你用git添加它们之后,你有没有改变它们?你的行结束设置是什么? –

回答

2

通知书上的两个部分的标题:变更,必须致力于变化不是上演提交

当您使用git add some_file.txt文件的当前状态(在这种情况下some_file.txt)正在上演被列入下一次的提交,使文件将出现在变更,必须致力于名单。如果在运行git commit之前对这些文件进行了进一步更改,除非再次运行git add,否则这些更改将不会进行,因此文件也将出现在列表中,但未对列表提交更改。

当你运行git commit,你通过了-a标志(简称--all)自动阶段已被修改或删除的所有文件。这相当于在运行git commit之前对中的所有文件执行git add更改未进行提交列表。

+0

这就是它。这太错误了,这似乎是明显的,合乎逻辑的和理想的行为。完美的答案,现在一切都清晰可见。我学到了一些关于git = D的知识。 – hjc1710

0

运行git diff显示未分级的更改和git diff --cached显示分级更改。

您可能在不知不觉中更改了这些文件中的行尾。 Windows优先选择2个字节的终止行(回车符和换行符)。 Unix更喜欢用1字节结束行(只是一个换行符)。

相关问题