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)
Shelving is temporarily storing pending changes you have not committed yet. This is useful, for example, if you need to switch to another task, and you want to set your changes aside to work on them later. With IntelliJ IDEA, you can shelve both separate files and entire changelists.
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.
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."
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