git stash

git stash // 把已经修改的东西放到栈里
git stash list // 查看放到栈中的stash
git stash apply // 应用最近的一次的栈中的数据
git stash apply stash@{2} // 应用某一个stash

// 同时也可以切换到另一个分支,分支上已经修改的有内容,然后应用git stash

git stash apply --index // 应用暂存的变更

apply 选项只尝试应用储藏的工作——储藏的内容仍然在栈上。要移除它,你可以运行 git stash drop,加上你希望移除的储藏的名字

你也可以运行 git stash pop 来重新应用储藏,同时立刻将其从堆栈中移走

// 撤销储藏
$ git stash show -p stash@{0} | git apply -R

// 同样的,如果你沒有指定具体的某个储藏,Git 会选择最近的储藏:
$ git stash show -p | git apply -R

// 恢复储藏工作,在新的分支继续一个提交
原文地址:https://www.cnblogs.com/cjjjj/p/9992233.html