Usage: git stash list [<options>]
or: git stash show [<stash>]
or: git stash drop [-q|--quiet] [<stash>]
or: git stash ( pop | apply ) [--index] [-q|--quiet] [<stash>]
or: git stash branch <branchname> [<stash>]
or: git stash [save [--patch] [-k|--[no-]keep-index] [-q|--quiet]
[-u|--include-untracked] [-a|--all] [<message>]]
or: git stash clear
好的。它不起作用。然后我尝试git checkout file_name
。Git没有抱怨。然后我可以在不保存对第一个分支的更改的情况下切换到另一个分支。所以,看来我得到了我需要的东西(去到第二个分支)。
但是,我想问一下为什么stash
没有起作用,如果它起作用会产生什么不同的最终结果?
stash
没有起作用是因为你使用不正确。请参阅git help stash
。你所要求的区别在于,如果你已经将更改存储,那么它们将被存储,但现在你失去了这些更改。 - Biffengit help stash
会详细解释这个问题。 - Wooblegit help stash
以及 此处。 - Biffen