Git–Why Should I Care about the Index?

By Charles Bailey

One of the unique features of Git is its “index” but it is often poorly understood and frequently cited as confusing, especially for newcomers to Git.

What is the index and why does Git have it?

The index is a staging area for your next commit. It is also a “stat” cache which ensures that Git has the performance characteristics that it needs. The index is also the merge resolution area. The fact that the index supports these diverse purposes contributes to its conceptual complexity.

To dispel some of the confusion that surrounds the index we look at the internals, what is stored in the index and how it is stored.

We look at what operations read and update the index in normal usage. We also examine what commands we can use to deliberately affect the index and why we might want to perform them.





Your Privacy

By clicking "Accept Non-Essential Cookies" you agree ACCU can store non-essential cookies on your device and disclose information in accordance with our Privacy Policy and Cookie Policy.

Current Setting: Non-Essential Cookies REJECTED


By clicking "Include Third Party Content" you agree ACCU can forward your IP address to third-party sites (such as YouTube) to enhance the information presented on this site, and that third-party sites may store cookies on your device.

Current Setting: Third Party Content EXCLUDED



Settings can be changed at any time from the Cookie Policy page.