Git Shelve vs Stash

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?


git shelve doesn't exist in Git.

Only 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.
  • which saves your local modifications away and reverts the working directory to match the HEAD commit.
  • 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.


    当使用JetBrains IDE和Git时,除了搁置和不支持外,还支持“存储和不存储”这些特性,这些特性有许多共同之处;主要区别在于生成和应用补丁的方式。的文件,而Stash只能同时运行一大堆文件,以下是它们之间差异的更多细节。“


    In addition to previous answers there is one important for me note:

    shelve is JetBrains products feature (such as WebStorm , PhpStorm , PyCharm , etc.). It puts shelved files into .idea/shelf directory.

    stash is one of git options. It puts stashed files under the .git directory.

    链接地址: http://www.djcxy.com/p/24502.html

    上一篇: Git:只存储一个文件

    下一篇: Git Shelve vs藏匿