git stash 当本地代码不想提交覆盖,又忙于其他分支,可以先储存起来。

git stash命令的作用就是将目前还不想提交的但是已经修改的内容进行保存至堆栈中,后续可以在某个分支上恢复出堆栈中的内容。这也就是说,stash中的内容不仅仅可以恢复到原先开发的分支,也可以恢复到其他任意指定的分支上。git stash作用的范围包括工作区和暂存区中的内容,也就是说没有提交的内容都会保存至堆栈中。

git stash

存储当前工作目录

$ git stash
Saved working directory and index state WIP on Practice: 2f70846 Complete practice
view and network

git stash list

查看之前存储的所有版本列表

$ git stash list
stash@{0}: WIP on Practice: 2f70846 Complete practice view and network
stash@{1}: WIP on Practice: 2f70846 Complete practice view and network
stash@{2}: WIP on Practice: 2f70846 Complete practice view and network
stash@{3}: WIP on Practice: 2f70846 Complete practice view and network
stash@{4}: WIP on Practice: 812e77b Add collectionView and AnswerView
stash@{5}: WIP on Practice: 53bb0c1 add tableView of questions and refactor the code of scrollView

git stash pop [stash_id]

恢复具体某一次的版本,如果不指定stash_id,则默认h恢复最新的存储进度  

$ git stash pop stash@{}
Auto-merging WePeiYang/Shared/Network/SolaSessionManager.swift
CONFLICT (content): Merge conflict in WePeiYang/Shared/Network/SolaSessionManager.swift
Auto-merging WePeiYang/Practice/Practice/QuestionTableView/OptionsCell.swift
CONFLICT (content): Merge conflict in WePeiYang/Practice/Practice/QuestionTableView/OptionsCell.swift
Auto-merging WePeiYang/Practice/Practice/Exercise/Model/ExerciseNetwork.swift
Auto-merging WePeiYang.xcodeproj/project.pbxproj
CONFLICT (content): Merge conflict in WePeiYang.xcodeproj/project.pbxproj
恢复之后,有时打开工程文件,会发现里面所有文件都不翼而飞了?!
莫慌,莫慌
这是因为出现合并冲突的问题而导致工程文件打不开。
这时候右击工程文件,单击“显示包内容”,打开“project.pbxproj”文件,然后command + f 搜索 “stashed”。把冲突部分删掉就可以重新打开啦
 

git stash drop [stash_id]
删除一个存储的进度。如果不指定stash_id,则默认删除最新的存储进度。

 
git stash clear
清除所有的存储进度

原文链接:https://www.jianshu.com/p/a634af0eb343?from=singlemessage

 

最新文章

  1. Java基础回顾
  2. iOS 学习 - 18.TextField 自定义菜单事件,复制和微信分享
  3. 简单介绍一下python Queue中常用的方法
  4. 花生壳动态IP域名解析之python自动提交公网IP
  5. git log 格式化输出
  6. sql语句按照汉字拼音首字母排序
  7. mac上卸载oracle jdk 1.8.0_31
  8. sdutoj 2606 Rubik’s cube
  9. 学习从零开始写jQuery框架
  10. finder的隐藏文件&IOS虚拟机地址
  11. nmap十条常用命令行格式
  12. mysql参数sql_log_bin
  13. CCF真题之图像旋转
  14. vm克隆虚拟机网络配置
  15. IntelliJ IDEA常用快捷键
  16. uva 1146 Now or late (暴力2-SAT)
  17. Linux3.10.0块IO子系统流程(7)-- 请求处理完成
  18. NSCache的简单使用
  19. 4、JDBC-API
  20. HRBUST1311 火影忍者之~忍者村 2017-03-06 16:06 106人阅读 评论(0) 收藏

热门文章

  1. 创建entityManager
  2. git路径超长 及gitignore
  3. django之配置文件setting.py
  4. JavaWeb(七):EL表达式、自定义标签和JSTL
  5. python其他篇(1)
  6. Java缓冲流高效大文件的复制实例
  7. TPS、QPS和系统吞吐量的区别和理解
  8. (转)Servlet 3.0/3.1 中的异步处理学习
  9. 一文读懂PID控制算法(抛弃公式,从原理上真正理解PID控制)
  10. 圆周运动的css3特效案例