在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