使用场景:

一、本来应该在B分支开发,但是代码写错分支,代码写在了A分支,A还没有提交,可以使用git stash save "test-cmd-stash",报错在缓存栈中,然后切换到A分支,重新从缓存栈中恢复到当前分支,git stash pop

步骤:

  1、在B分支开发了代码,使用git stash save "test-cmd-stash"保存在缓存栈中

  2、切换到A分支,git stash pop恢复缓存栈道当前分支

 

  查看缓存栈中的内容:git stash list

 移除缓存栈中的内容:git stash drop

清除所有缓存栈中的内容:git stash clear