• git diff比较使用


    git diff 等同于 git diff HEAD

    jiqing@ubuntu:/home/wwwroot/default/siemens/new_hotel$ git diff HEAD
    diff --git a/Index/Lib/Action/GetDataAction.class.php b/Index/Lib/Action/GetDataAction.class.php
    index 1550a57..0f79846 100644
    --- a/Index/Lib/Action/GetDataAction.class.php
    +++ b/Index/Lib/Action/GetDataAction.class.php
    @@ -60,8 +60,16 @@ class GetDataAction extends Action{
         }
     
         /**
    -     * 获取统计数据
    -     *
    +     *  统计数据展示
    +     *  1 点我制作
    +     *  2 开始
    +     *  3 马上拍照
    +     *  4 上一步
    +     *  5 生成
    +     *  6 重做
    +     *  7 分享
    +     *  8 ~ 26 (7 + i) 19个贴纸的点击,i为贴纸的id
    +     *  27 ~ 45 ( 26 + i) 19个贴纸的使用,i为贴纸的id
          */
    
    

    具体的某个版本与版本之间可以比较

    jiqing@ubuntu:/home/wwwroot/default/siemens/new_hotel$ git diff HEAD^ HEAD^^
    diff --git a/Index/Lib/Action/GetDataAction.class.php b/Index/Lib/Action/GetDataAction.class.php
    index 1550a57..d997bcd 100644
    --- a/Index/Lib/Action/GetDataAction.class.php
    +++ b/Index/Lib/Action/GetDataAction.class.php
    @@ -17,8 +17,9 @@ class GetDataAction extends Action{
          *  5 生成
          *  6 重做
          *  7 分享
    -     *  8 ~ 26 (7 + i) 19个贴纸的点击,i为贴纸的id
    -     *  27 ~ 45 ( 26 + i) 19个贴纸的使用,i为贴纸的id
    +     *  8 点我制作
    +     *  9 ~ 27 (8 + i) 19个贴纸的点击,i为贴纸的id
    +     *  28 ~ 46 ( 27 + i) 19个贴纸的使用,i为贴纸的id
          */
         public function get_data(){
             if(trim($_POST['type'])){
    @@ -58,15 +59,4 @@ class GetDataAction extends Action{
                 send_http_status(200);
             }
         }
    
    

    前后顺序无所谓

    jiqing@ubuntu:/home/wwwroot/default/siemens/new_hotel$ git diff HEAD^^ HEAD^
    diff --git a/Index/Lib/Action/GetDataAction.class.php b/Index/Lib/Action/GetDataAction.class.php
    index d997bcd..1550a57 100644
    --- a/Index/Lib/Action/GetDataAction.class.php
    +++ b/Index/Lib/Action/GetDataAction.class.php
    @@ -17,9 +17,8 @@ class GetDataAction extends Action{
          *  5 生成
          *  6 重做
          *  7 分享
    -     *  8 点我制作
    -     *  9 ~ 27 (8 + i) 19个贴纸的点击,i为贴纸的id
    -     *  28 ~ 46 ( 27 + i) 19个贴纸的使用,i为贴纸的id
    +     *  8 ~ 26 (7 + i) 19个贴纸的点击,i为贴纸的id
    +     *  27 ~ 45 ( 26 + i) 19个贴纸的使用,i为贴纸的id
          */
         public function get_data(){
             if(trim($_POST['type'])){
    @@ -59,4 +58,15 @@ class GetDataAction extends Action{
                 send_http_status(200);
             }
         }
    
    

    git diff 分支1 分之2

    看详细差异

    jiqing@ubuntu:/home/wwwroot/default/siemens/new_hotel$ git diff siemens master 
    diff --git a/.gitignore b/.gitignore
    index 8f32300..6655344 100755
    --- a/.gitignore
    +++ b/.gitignore
    @@ -49,8 +49,6 @@ Shop/Runtime
     */*~
     Public/Public
     Public/upload/bgimg/*
    -Public/log/*
    -Public/tmp/*
     !Public/upload/bgimg/.tmp
     
     .settings/
    diff --git a/Index/Conf/config.php b/Index/Conf/config.php
    index 4fd4d44..3124482 100644
    --- a/Index/Conf/config.php
    +++ b/Index/Conf/config.php
    @@ -1,13 +1,4 @@
    
    

    git diff 分支1 分之2 --stat
    看大局差异

    jiqing@ubuntu:/home/wwwroot/default/siemens/new_hotel$ git diff siemens master --stat
     .gitignore                                                 |    2 -
     Index/Conf/config.php                                      |   21 +-
     Index/Lib/Action/CommonAction.class.php                    |   61 +--
     Index/Lib/Action/GetDataAction.class.php                   |   72 ---
     Index/Lib/Action/SiemensAction.class.php                   |  715 ----------------------------
     Index/Tpl/Circus/index.html                                |    3 +-
     Index/Tpl/Siemens/index.html                               |  327 -------------
     Index/Tpl/Siemens/share.html                               |   54 ---
     Public/MP_verify_HIkhmwma5QBj98ns.txt                      |    1 -
     Public/index.php                                           |    4 +-
     Public/siemens/css/.font-spider/PingFang ExtraLight.ttf    |  Bin 11035472 -> 0 bytes
     Public/siemens/css/.font-spider/wryh.ttf                   |  Bin 15043584 -> 0 bytes
     Public/siemens/css/animate.css                             | 3279 -------------------------------------------------------------------------------------------------------------------------------
     Public/siemens/css/animate.min.css                         |    6 -
     Public/siemens/css/index.css                               |  605 ------------------------
     Public/siemens/css/index.scss                              |  540 ---------------------
     Public/siemens/css/reset.min.css                           |    2 -
     Public/siemens/css/swiper.min.css                          |   15 -
     Public/siemens/css/zepto.plugin.css                        |   87 ----
     Public/siemens/css/zepto.plugin.scss                       |   87 ----
     Public/siemens/font/msyh.ttf                               |  Bin 21767952 -> 0 bytes
    
    

    还可以进行本地分支与线上分支的比较

    jiqing@ubuntu:/home/wwwroot/default/5hao/sheep-doc$ git diff origin/5hao
    diff --git a/cart.md b/cart.md
    index 0174a54..b2861b3 100644
    --- a/cart.md
    +++ b/cart.md
    @@ -80,7 +80,6 @@ uid        有则传,无则不传
             "name": "法兰西苹果",  
             "has_activity": 0,                     
             "id": "1",                              // 商品id   
    -        "type":"1",                     //type:1.自营商品;2.积分好货
             "collection" : 1
             "is_relation_attr": [
             {
    @@ -111,7 +110,6 @@ uid        有则传,无则不传
             "has_activity": 0,
             "collection" : 1
             "id": "2",
    -        "type":"2",                     //type:1.自营商品;2.积分好货
             "is_relation_attr": [
             {
                 "name": "产地",
    
    

    默认拿当前本地版本对比线上的最新版本。

    如果有一段时间,没有更新,则需要处理一下,才能对比出最新的代码。

    git fetch origin
    git diff yanglu origin/gaodian
    

    或者只看文件

    git diff yanglu origin/gaodian --stat
    
  • 相关阅读:
    代码大全2阅读笔记之最后总结
    web商品系统最终版
    web商品系统
    期末总结
    2020/12/13
    2020/12/12
    2020/12/11
    2020/12/10
    2020/12/09
    2020/12/08
  • 原文地址:https://www.cnblogs.com/jiqing9006/p/8832432.html
Copyright © 2020-2023  润新知