u123
u123

Reputation: 16287

What happens to the git index when I commit?

When I run git commit, the changes in the index are added to the local repository.

However, what happens to the index afterwards? Some GUI tools, e.g Eclipse EGit shows that the index is cleared, but isn't that misleading? After a commit, are the contents of the index just the same as the contents of the local repository?

Upvotes: 1

Views: 460

Answers (1)

user743382
user743382

Reputation:

The index is indeed not changed when you commit (assuming you have no weird hooks, anyway).

What those GUI tools show is not the index, but the changes between the index and the current commit. By committing, the index does not change, but there will no longer be any differences between the index and the commit.

Upvotes: 6

Related Questions