What is the difference between IntelliJ's Shelve and Git stash?

From the IntelliJ documentation:

In the Git integration, in addition to shelving and unshelving, "stashing" and "unstashing" are supported respectively. These features have much in common, the only difference is in the way patches are generated and applied.

  • Patches with stashed changes are generated by Git itself. To apply them later, you do not need IntelliJ IDEA.
  • Patches with shelved changes are generated by IntelliJ IDEA. Normally, they are also applied through the IDE. Applying shelved changes outside IntelliJ IDEA is also possible but requires additional steps.

They are pretty similar except:

  • You can't use shelve outside IDE, because it is Intellij's feature.
  • Git stash works only with entire working directory and index. IntelliJ's shelve can work with individual files and changelists (another IntelliJ's feature). As you can see, for example, here, sometimes it is necessary.
  • Idea has better built-in support for shelve. Working with git stash is more straightforward. In particular, you can shelve\unshelve your changes or review shelved files from version control tool window.

Also, IMHO, shelve works slightly faster, especially in a big project, when lots of files were changed.

See the documentation for more info.


One distinct advantage that Intellij's Shelve has over plain Git's stash is that using Shelve, you can save changes belonging to multiple repos in one changelist. Using stash, you would need to stash/unstash in each repo individually. This is very useful in a large project with multiple modules (each having its own repo) where a particular feature work may cut across multiple modules (and therefore multiple repos)