为什么结账和重置会改变索引? [英] Why do checkout and reset change the index?
问题描述
我认为索引只是针对下一次提交的文件而已,但重置和签出也会更新索引:
为了做好准备,通过更新索引和工作树中的文件来切换到它,
这个想法是,git总是提交当前状态的快照,而不仅仅是差异。因此,在进行结帐时,索引将被更新为包含您刚刚签出的内容的快照,然后更改添加文件/更改。
我的问题是因为我在不正确的假设下操作,只有变化才会被添加到索引中。
I thought that the index is just for the files you staged for the next commit, but both reset and checkout also update the index:
To prepare for working on , switch to it by updating the index and the files in the working tree,
The idea is that git always commits snapshots of the current state and not just diffs. So when doing a checkout, the index will be updated to contain a snapshot of what you just checked out, which you then change adding files/changes.
My question is because I operated under the incorrect assumption that only changes would be added to the index.
这篇关于为什么结账和重置会改变索引?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!