Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What does "Keep Index" option of Git stash dialog in Intellij IDEA do?

It is said in IDEA documentation

Select this check box to have IntelliJ IDEA bring the changes staged in the index to your working tree for examination and testing.

Can somebody please explain what does this mean?

like image 618
humkins Avatar asked Aug 22 '16 14:08

humkins


People also ask

What is stash in IntelliJ?

Stashing changes is very similar to shelving. The only difference is in the way patches are generated and applied. Stashes are generated by Git, and can be applied from within IntelliJ IDEA, or outside it. Patches with shelved changes are generated by IntelliJ IDEA and are also applied through the IDE.

What does stash does in git?

git stash temporarily shelves (or stashes) changes you've made to your working copy so you can work on something else, and then come back and re-apply them later on.

When should I use git stash?

Use git stash when you want to record the current state of the working directory and the index, but want to go back to a clean working directory. The command saves your local modifications away and reverts the working directory to match the HEAD commit.


1 Answers

This determines if the stash is created with the git --keep-index flag.

From GIT docs:

If the --keep-index option is used, all changes already added to the index are left intact.

So in other words, any files you've added to git will also remain outside of the stash when you create it. Whereas normally newly added files would be removed after stashing. (See this question for a more indepth description of where the index is.)

like image 59
phaze0 Avatar answered Oct 01 '22 22:10

phaze0