git stash 用法
git stash:将工作区的修改暂时缓存起来
1、git stash
实际应用中推荐给每个stash加一个message,用于记录版本,使用git stash save
取代git stash
命令:
如:$ git stash save "test-cmd-stash" ;
2、git stash list :查看所有缓存的内容;
3、git stash pop :命令恢复之前缓存的工作目录,
这个指令将缓存堆栈中的第一个stash删除,并将对应修改应用到当前的工作目录下;
4、git stash apply
将缓存堆栈中的stash多次应用到工作目录中,但并不删除stash拷贝,注意git中不能有modified的文件
可以通过名字指定使用哪个stash,默认使用最近的stash(即[email protected]{0});
5、git stash drop
或者使用git stash clear
命令,删除所有缓存的stash;
6、git stash show
在该命令后面添加-p
或--patch
可以查看特定stash的全部diff