Git stash似乎做了很多我想做的事情,除了编写脚本有点困难,因为如果你没有更改,那么Git stash;gitstashpop将做一些不同于在存储库中进行更改的事情。
看来git stash create是这个问题的答案,而且一切都有效,除了一件事……我无法摆脱创建的stash。有什么办法把这些东西扔掉吗?
为了100%明确我在做什么:
创建存储:
~/tmp/a(master) $ git stash create
60629375d0eb12348f9d31933dd348ad0f038435
~/tmp/a(master) $ git st
# On branch master
# Changes to be committed:
# (use "git reset HEAD <file>..." to unstage)
#
# new file: b
#
~/tmp/a(master) $ git reset --hard
HEAD is now at 555d572 log message
使用存储:
~/tmp/a(master) $ git apply 60629375d0eb12348f9d31933dd348ad0f038435
fatal: can't open patch '60629375d0eb12348f9d31933dd348ad0f038435': No such file or directory
~/tmp/a(master) $ git stash apply 60629375d0eb12348f9d31933dd348ad0f038435
# On branch master
# Changes to be committed:
# (use "git reset HEAD <file>..." to unstage)
#
# new file: b
#
删除隐藏:(除了最后一位不起作用)
~/tmp/a(master) $ git stash drop !$
git stash drop 60629375d0eb12348f9d31933dd348ad0f038435
'60629375d0eb12348f9d31933dd348ad0f038435' is not a stash reference