git stash用法总结

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
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值