在Git中,暂存区域也被称为索引。似乎要说的是,当你在工作目录中进行更改并将这些更改添加到“暂存”中时,git会将这些文件添加到索引文件中。当打开一个项目/.git/index文件,我看到一个包含显示,当我键入文本的文件:git索引在哪里?
git status
我可以得到的输出将是这样的:
# On branch master
# 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: Gemfile
#
no changes added to commit (use "git add" and/or "git commit -a")
但在其他像Git Index Contents地方,他们说,通过键入:
git ls-files --stage
你可以看到指数...的内容,虽然这显然不是什么在/.git/index。 .git目录中的哪个文件实际上包含此索引?我怀疑,我可能是错的..是.git/index存储变更信息在'修改'行,然后当输入git ls-files - 它正在建立一个文件列表是基于工作目录中的文件以及在此索引文件中被列为已修改的文件的分段和哈希。这是正确的吗?
请参阅http://stackoverflow.com/questions/4084921/what-does-the-git-index-exactly-contains – GoZoner 2013-03-12 03:45:04