git stash 应用

来源:互联网 发布:航天发票数据管理软件 编辑:程序博客网 时间:2024/06/06 23:10

在当前分支上正在修改, 需要修复另外一个分支的bug,不想提交当前的修改的时候使用

  1. git stash list()
  2. git stash clear
  3. git stash
  4. git checkout master
  5. git checkout -b new
  6. 提交完之后,切回到之前修改的分支
  7. git stash apply

tip:
1. stash 是不同分支公用的 不要再其他的分支下 对stash list执行操作
2. 最好在每次恢复到 执行clear stash操作

误删除stash 的文件之后该如何恢复

1.git fsck --lost-found
2.git show commitID
3.git stash apply commitID

0 0
原创粉丝点击