我想了解Git在将文件移入“暂存”状态时实际存储了什么。
考虑以下序列:
添加并提交新文件至本地代码库:
touch file.txt
git add file.txt
git commit
我对文件进行了更改:
echo text1 > file.txt
git add file.txt
然后我再次编辑文件,然后提交:
echo text2 > file.txt
git status 显示:
# On branch master
# Changes to be committed:
# (use "git reset HEAD <file>..." to unstage)
#
# modified: file.txt
#
# Changed but not updated:
# (use "git add <file>..." to update what will be committed)
# (use "git checkout -- <file>..." to discard changes in working directory)
#
# modified: file.txt
#
我接着提交了这个文件:
git commit file.txt
Git如何能够在没有被通知的情况下处理新的、第二次更新的file.txt的暂存呢?“状态”输出的结果似乎会尝试检查第一个修订版,但会保留未暂存的更改而不将它们检入。
这种情况下是否存在隐式的暂存操作?