git stash用法总结

来源:互联网 发布:防复制软件 编辑:程序博客网 时间:2024/06/07 15:30

1 stash是本地的,不会通过git push命令上传到git server上


2 使用git stash暂存修改时,除了用git stash直接保存外,还可以给每个stash加一个标记,

git stash save <message>


git stash --help

save [-p|--patch] [-k|--[no-]keep-index] [-u|--include-untracked] [-a|--all] [-q|--quiet] [<message>]

Save your local modifications to a new stash, and run git reset --hard to revert them. The <message> part is optional and gives the description along with the stashed state.


3 git stash pop与gite stash apply的区别

 pop [--index] [-q|--quiet] [<stash>]

 Remove a single stashed state from the stash list and apply it on top of the current working tree state

 apply [--index] [-q|--quiet] [<stash>]

Like pop, but do not remove the state from the stash list

git stash apply可以将缓存堆栈中的stash多次应用到工作目录中,不删除stash拷贝


4 查看已有的stash

   git stash list

在使用git stash apply命令时可以通过名字指定使用哪个stash,默认使用最近的stash(即stash@{0}



0 0
原创粉丝点击