How do I solve a dirty index in Eclipse?

n00b1990 picture n00b1990 · Jun 18, 2014 · Viewed 24.4k times · Source

I have the following problem in eclipse:

enter image description here

How do I solve a dirty index?

Answer

Sascha Wolf picture Sascha Wolf · Jun 18, 2014

The index is the place in git where you register the changes you want to include in your next commit (via git add).

If you have no changes recorded on your index at all, the index is considered clean, but if there are files added to the index, the index is considered dirty.

The same applys to your working tree (the checked out files from your repository). If you made changes to them, they are dirty otherwise they are clean.

To make your index clean you could do a reset to just remove the changes from the index but not from the working tree, to also remove them from the working tree you can use git stash via the command line, or via the Git Repositories view in Eclipse.

Eclipse Git Stash

When you stash changes they get saved just like a commit but you easily regain and delete stashes. You can consider them as some kind of cache. You can read more here.

If you stash the changes you can regain them by applying them back to the repository via the command line (git stash apply) or via EGit (see Stashed Commits).