Git Shelve vs Stash

后端 未结 5 1232
孤独总比滥情好
孤独总比滥情好 2020-12-07 10:29

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

5条回答
  •  没有蜡笔的小新
    2020-12-07 11:17

    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:

    • https://www.jetbrains.com/help/idea/shelving-and-unshelving-changes.html
    • https://www.jetbrains.com/help/idea/work-on-several-features-simultaneously.html

提交回复
热议问题