• git stash 后"本地代码不见了"


    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@{0}
    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

     
  • 相关阅读:
    Octave Tutorial(《Machine Learning》)之第二课《数据移动》
    Octave Tutorial(《Machine Learning》)之第一课《数据表示和存储》
    《Machine Learning》系列学习笔记之第三周
    《Machine Learning》系列学习笔记之第二周
    《Machine Learning》系列学习笔记之第一周
    如何下载图片新闻并将其写入文件
    openmv之ApriTag
    opencv学习记录之阈值处理
    opencv学习记录之几何变换
    opencv学习记录之alpha通道
  • 原文地址:https://www.cnblogs.com/panax/p/11912965.html
Copyright © 2020-2023  润新知