git stash

git stash

用法:
git stash 储存当前修改
git stash list 查看当前全部的储存
git stash apply 应用最新的储存,(不要求在相同分支,若是储存和当前目录的修改有冲突,能够解决冲突)
git stash apply stash@{2} 选择应用哪一个stash
git stash apply --index 若是当前目录有修改,再应用时同时将本地的修改也更新到stash中
git stash drop 使用apply时,只是取出stash,并未将stash drop掉,能够用drop丢掉某个stash
git stash pop 做用至关于先使用apply,再用drop
取消储藏:没有提供直接的命令,能够经过取消储藏的补丁实现,git stash show -p stash@{0} | git apply -R
从储藏中建立分支:有时,你在stash后的分支作了许多其它工做,你想从新应用储藏时可能遇到一些问题,能够以当时应用的那个储藏的commit建立一个分支,再在这个分支上应用储藏, git stash branch new_brach_namehtml

相关文章
相关标签/搜索