在Git中,一个人可以创建多个储藏:
git stash save "quick temp stash"
git stash save "another quick temp stash"
git stash save "This is important but I need to put it on the back burner"
git stash save "This is almost certainly garbage, but just in case ..."
现在,我知道我可以以任何顺序获取那些隐藏的物品:
git stash pop stash@{3} # recover quick temp stash
git stash pop stash@{2} # recover another quick temp stash
但是显然更方便的语法更可取:
git stash pop
这不仅是因为要输入的内容更少,而且需要思考的内容也更少:如果我有几个藏匿物,我必须查找它们,可能会使用git stash show
命令查看其中一些,直到找到我想要的那个。但如果我只保留最近的“temp”藏匿物在最上面(其次是下一个temp藏匿物等等),我根本不需要思考;我只需要使用pop
命令即可。
所以,我的问题是,是否有任何方法可以重新排序我的藏匿物,以便我可以在保存它们时考虑何时应该“pop”,而不是在“pop”它们时考虑。这将使我仍然能够保存“这几乎肯定是垃圾,但以防万一…”和“这很重要,但我需要把它放在后面”的藏匿物,但它们位于藏匿列表的后面,不会干扰访问更简单的快速藏匿物。