zoukankan      html  css  js  c++  java
  • Git日志操作

          1.查看日志

    $ git log
    commit 4484696d518ce0938e46ed7b346b3219f5428cfd
    Author: yuanchengbo <yuanchengbo@csair.com>
    Date:   Thu Oct 26 20:44:02 2017 +0800
    
        modified 111 to 222
    
    commit e66ad601e30d8be6a3986c4788d4bea0c1d7e5a7
    Author: yuanchengbo <yuanchengbo@csair.com>
    Date:   Thu Oct 26 20:40:19 2017 +0800
    
        add 111
    
    commit 4db97b2381eae5cc61fd77527ea2af53bac4725f
    Author: yuanchengbo <yuanchengbo@csair.com>
    Date:   Thu Oct 26 20:32:51 2017 +0800
    
        add dudu in 2.txt
    

      上面是使用了git log命令后,截取了靠前的三个log信息。

          2.使用git show查看具体的信息

    $ git show 4484696
    commit 4484696d518ce0938e46ed7b346b3219f5428cfd
    Author: yuanchengbo <yuanchengbo@csair.com>
    Date:   Thu Oct 26 20:44:02 2017 +0800
    
        modified 111 to 222
    
    diff --git a/2.txt b/2.txt
    index 58c9bdf..c200906 100644
    --- a/2.txt
    +++ b/2.txt
    @@ -1 +1 @@
    -111
    +222
    

      show之后接的是commit 的id,并不需要输全,Git是会自己去匹配的。

           3.使用-p查看log具体的信息

    $ git log -p
    commit 4484696d518ce0938e46ed7b346b3219f5428cfd
    Author: yuanchengbo <yuanchengbo@csair.com>
    Date:   Thu Oct 26 20:44:02 2017 +0800
    
        modified 111 to 222
    
    diff --git a/2.txt b/2.txt
    index 58c9bdf..c200906 100644
    --- a/2.txt
    +++ b/2.txt
    @@ -1 +1 @@
    -111
    +222
    
    commit e66ad601e30d8be6a3986c4788d4bea0c1d7e5a7
    Author: yuanchengbo <yuanchengbo@csair.com>
    Date:   Thu Oct 26 20:40:19 2017 +0800
    
        add 111
    
    diff --git a/2.txt b/2.txt
    index 6bf0568..58c9bdf 100644
    --- a/2.txt
    +++ b/2.txt
    @@ -1 +1 @@
    -dudu is the best
    +111
    

      使用-p属性显示的是每条log的具体信息了。

          4.使用-n查看前n条信息

          加入log太多,只想看最近的几条log。可以使用-n来限定

    $ git log -p -1
    commit 4484696d518ce0938e46ed7b346b3219f5428cfd
    Author: yuanchengbo <yuanchengbo@csair.com>
    Date:   Thu Oct 26 20:44:02 2017 +0800
    
        modified 111 to 222
    
    diff --git a/2.txt b/2.txt
    index 58c9bdf..c200906 100644
    --- a/2.txt
    +++ b/2.txt
    @@ -1 +1 @@
    -111
    +222
    

      这里使用-p -1现在最近的一条的具体信息。

         5.查看粗略的信息

    $ git log --stat -1
    commit 4484696d518ce0938e46ed7b346b3219f5428cfd
    Author: yuanchengbo <yuanchengbo@csair.com>
    Date:   Thu Oct 26 20:44:02 2017 +0800
    
        modified 111 to 222
    
     2.txt | 2 +-
     1 file changed, 1 insertion(+), 1 deletion(-)
    

      你觉得-p显示的信息太复杂,只想要简单的信息,可以使用--stat属性,同样也可以使用-n来限制log数量。

  • 相关阅读:
    安卓监听帧动画结束
    零基础学python-13.4 文件上使用列表解析与列表解析扩展
    零基础学python-13.3 列表解析简介与步骤分解
    零基础学python-13.2 手动迭代:iter和next
    零基础学python-13.1 迭代器简介与文件迭代器
    零基础学python-12.6 使用for和zip来并行使用多个序列
    零基础学python-12.5 修改列表的误区以及使用for和range修改列表
    零基础学python-12.4 while、for与range联合使用
    零基础学python-12.3 for循环
    零基础学python-12.2 关键字pass,else,break,continue
  • 原文地址:https://www.cnblogs.com/bocurry/p/7761827.html
Copyright © 2011-2022 走看看