What is the purpose of git stash create and git stash store?

后端 未结 2 407
难免孤独
难免孤独 2021-02-05 09:02

From the documentation at git-scm, there are two git stash commands that mention relevance to scripting, but not general use:

create

2条回答
  •  傲寒
    傲寒 (楼主)
    2021-02-05 10:01

    You can use git stash create when you're writing scripts that need to stash as an implementation detail and you don't want to disturb the user's stash reflog.

    Depending on what happens next, you might (in the case of error, say) decide you do want to disturb the stash reflog after all, at which point you can use git stash store.

    Obviously a regular stash can be implemented in terms of create then store, but I can also imagine it being used in a hypothetical update-branch command that does something like this:

    git stash create
    git fetch
    git rebase
    git stash apply
    

提交回复
热议问题