The term 'shelve' references a commonly understood process that takes some temporary file changes, saves them locally and outside of the current version control system and then returns to those files at some point in the future. This concept is built right into the Git tool, but it's not named shelve.
Shelving is the closest equivalent of git stash, as explained in Douglas Leeder's answer.
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.
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.
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:
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)
Here is what Documentation Says
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. Also, stashing involves all uncommitted changes, while when you put changes to a shelf, you can select some of the local changes instead of shelving them all.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With