如果你堆积了很多存储,它会变得相当混乱(我想要的存储是stash@{7}还是stash@{4}?等等,我刚刚推了另一个,现在它们是8和5?)。我个人更喜欢将这些更改转移到一个新的分支,因为分支有名称,cleanup-attempt-in-December对我来说比stash@{12}更重要。(git stash命令需要一个可选的保存消息,这些可以帮助,但不知何故,我所有的存储最终都被命名为WIP on branch。)
git status # see if there's anything you need to commit# uh oh, there is - let's put it on a new temp branchgit checkout -b temp # create new temp branch to save stuffgit add ... # add (and/or remove) stuff as neededgit commit # save first set of changes
现在你站在一个“干净”的起点上。或者更像这样:
git status # see if there's anything you need to commit# status says "nothing to commit"git checkout -b temp # optional: create a new branch for "apply"git stash apply # apply stashed changes; see below about --index