git stash 后"本地代码不见了"
2024-09-06 19:02:08
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”。把冲突部分删掉就可以重新打开啦
莫慌,莫慌
这是因为出现合并冲突的问题而导致工程文件打不开。
这时候右击工程文件,单击“显示包内容”,打开“project.pbxproj”文件,然后command + f 搜索 “stashed”。把冲突部分删掉就可以重新打开啦
git stash drop [stash_id]
删除一个存储的进度。如果不指定stash_id,则默认删除最新的存储进度。
git stash clear
清除所有的存储进度
原文链接:https://www.jianshu.com/p/a634af0eb343?from=singlemessage
最新文章
- Java基础回顾
- iOS 学习 - 18.TextField 自定义菜单事件,复制和微信分享
- 简单介绍一下python Queue中常用的方法
- 花生壳动态IP域名解析之python自动提交公网IP
- git log 格式化输出
- sql语句按照汉字拼音首字母排序
- mac上卸载oracle jdk 1.8.0_31
- sdutoj 2606 Rubik’s cube
- 学习从零开始写jQuery框架
- finder的隐藏文件&;IOS虚拟机地址
- nmap十条常用命令行格式
- mysql参数sql_log_bin
- CCF真题之图像旋转
- vm克隆虚拟机网络配置
- IntelliJ IDEA常用快捷键
- uva 1146 Now or late (暴力2-SAT)
- Linux3.10.0块IO子系统流程(7)-- 请求处理完成
- NSCache的简单使用
- 4、JDBC-API
- HRBUST1311 火影忍者之~忍者村 2017-03-06 16:06 106人阅读 评论(0) 收藏