I am very unfamiliar with the shelve aspect of Git. If stash is used to put aside unfinished work what is shelve then? What would you use it for?
For example on Update Project (from VCS menu)
one will get (in IntelliJ IDEA 2019.2)
git shelve doesn't exist in Git.
Only git stash:
You had a 2008 old project git shelve to isolate modifications in a branch, but that wouldn't be very useful nowadays.
As documented in Intellij IDEA shelve dialog, the feature "shelving and unshelving" is not linked to a VCS (Version Control System tool) but to the IDE itself, to temporarily storing pending changes you have not committed yet in changelist.
Note that since Git 2.13 (Q2 2017), you now can stash individual files too.
When using JetBrains IDE's with Git, "stashing and unstashing actions are supported in addition to shelving and unshelving. These features have much in common; the major difference is in the way patches are generated and applied. Shelve can operate with either individual files or bunch of files, while Stash can only operate with a whole bunch of changed files at once. Here are some more details on the differences between them."
I would prefer to shelve changes instead of stashing them if I am not sharing my changes elsewhere.
Stashing is a git feature and doesn't give you the option to select specific files or changes inside a file. Shelving can do that but this is an IDE-specific feature, not a git feature:
As you can see I am able to choose to specify which files/lines to include on my shelve. Note that I can't do that with stashing.
Beware using shelves in the IDE may limit the portability of your patches because those changes are not stored in a .git folder.
Some helpful links:
shelveis not a git command. What's the context for this question, where are these terms coming from?shelveexists in some other tools but it's not part of git. - Jonahshelvein bzr, hg, etc. Are you referring to some git interoperability package? - drRobertz