• git高级应用


    高级应用之一:

     

    二分法查找错误版本:

    当前日志

     

    $ git log --oneline

    ccda9d2 added test1

    dd518f7 test zu

    88095f9 dasfdasf

    3dc0ec9 first ok

     

    启动查找

    $ git bisect start

     

    标志当前版本为坏版本

     

    $ git bisect bad

     

    标志某个好版本作为起点

    $ git bisect good 3dc0ec9

    Bisecting: 0 revisions left to test after this (roughly 1 step)

    [dd518f77d5a48624965f2c88d1b7a7ddb3095556] test zu          =自动跳转到中间版本

     

    $ git log --oneline

    88095f9 dasfdasf

    3dc0ec9 first ok

     

    如果当前版本为坏版本,标志他

    $ git bisect bad

    Bisecting: 0 revisions left to test after this (roughly 0 steps)

    [88095f941af6e4a5aca06b33b40818bce7431636] dasfdasf =自动跳转到中间版本

     

    如果当前版本为好版本,标志他

    $ git bisect good

    dd518f77d5a48624965f2c88d1b7a7ddb3095556 is the first bad commit       =找到第一个坏版本并继续打印坏版本修改概要

    commit dd518f77d5a48624965f2c88d1b7a7ddb3095556

    Author: Xiaofeng Zu <xiaofeng.zu@gmail.com>

    Date:   Sun Sep 28 17:08:18 2014 +0800

     

        test zu

     

    :100644 100644 e5a209a255a7744382daef6a1335dcd8b629d9cc 0f552bfb85849fc12d5abcd9b701481acfdf25f7 M  test.c

     

    如果需要,可以用下面命令切换到第一个坏版本

    $ git checkout bisect/bad

    Previous HEAD position was 88095f9... dasfdasf

    HEAD is now at dd518f7... test zu

     

    查找结束,复位

    $ git bisect reset

     

    高级应用之二:

     

    查看任何文件的历史版本并转存

    git show 提交ID:文件路径 > 转存文件路径

     

    查看某个文件的修改记录

    git log <文件路径>

    git blame <文件路径>

     

    全部或某个文件切换到历史版本

    git checkout <提交ID>

    git checkout <提交ID> -- <文件路径>





  • 相关阅读:
    jq省份城市区街道数据整理成树型json并放到页面供网友选择
    python2爬取国家统计局全国省份城市区街道信息
    mp4视频中插入文字
    wap视频广告遇到的问题
    vscode(Visual Studio Code)中安装Debugger for Chrome插件调试页面
    学习node.js的一些笔记
    gulp打开gbk编码的html文件乱码
    解决[Errno 10048]报错
    MyBatis学习总结(一)
    Java学习之软件安装
  • 原文地址:https://www.cnblogs.com/EmbeddedLiving/p/7a0513f39826c7f29855a91124ef8ff0.html
Copyright © 2020-2023  润新知