Is the Git staging area just an index?

别来无恙 提交于 2019-12-03 22:29:06
manojlds

Index is a view of your working directory that is ready for commit. It can be seen as a pre-commit state and is not as simple as a "list of files". When you do git add, the file (with the change) is added to the index and the newer changes will not be see until you add them too.

The index is like an out basket of completed work. At any point you can add a (part) completed file to that out basket and it will replace the previous copy with your current copy, so that when you finally decide to commit it will use the contents of that out basket (the current index) to create the commit.

In addition your earlier add will have create a blob object within the repo that can be found if required via the various logs. After a while (30 days+) it will disappear with gc.

jolivier

It's an index but to a list of modification trees, not files directly. See the different type of objects git handle.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!