百度360必应搜狗淘宝本站头条
当前位置:网站首页 > 热门文章 > 正文

git log 命令用法实例 (2)

bigegpt 2025-02-10 11:28 9 浏览

使用 git log 命令查看提交记录时,默认打印commit hash值、作者、提交日期、和提交信息。如果想要查看更多内容,可以提供不同的参数来指定查看的信息。具体实例说明如下。

在git log中显示committer信息

git log 命令默认显示的里面只有author,没有committer,类似于下面的信息:

$ git log
commit b932a847f564c441d68fe954b19b2b275fd1e38d
Author: John 
Date: Mon Oct 21 16:18:09 2019 +0800
 hello release

如果要显示committer的信息,可以使用 --pretty=full 选项。例如下面显示的信息:

$ git log --pretty=full
commit b932a847f564c441d68fe954b19b2b275fd1e38d
Author: John 
Commit: John 
 hello release

查看 man git-log 对 --pretty 选项说明如下:

--pretty[=], --format=

Pretty-print the contents of the commit logs in a given format, where can be one of oneline, short, medium, full, fuller, email, raw and format:.

默认的 medium 格式样式如下:

 medium
 commit 
 Author: 
 Date: 
 
 <full commit message>
</pre><p>可以显示 committer 信息的 full 格式样式如下:</p><pre class="prism-highlight prism-language-bash"> full
 commit <sha1>
 Author: <author>
 Commit: <committer>
 <title line>
 <full commit message>
</pre><p><strong>这里的 author 和 committer 的区别是,author 是进行这个修改的人,而 committer 是把这个修改提交到git仓库的人。</strong></p><p>一般来说,我们自己修改代码,然后执行 git commit,那么既是 author,又是 committer。</p><p>如果别人用 git format-patch 生成 git patch,在patch文件里面会包含修改者的名称和邮箱信息。例如:</p><pre class="prism-highlight prism-language-bash">From 033abaaecd9a3133cfcc028726aa37ebdbe6bff4 Mon Sep 17 00:00:00 2001
From: Jobs <jobs@xxxx.com>
Date: Mon, 21 Oct 2019 16:18:09 +0800
Subject: [PATCH] hello release
</pre><p>我们拿到这个patch文件,用 git am 命令把patch合入本地仓库,那么 author 是这个patch文件的修改者 <em>Jobs</em>,而 committer 是我们自己。</p><h1>只查看某个人的提交历史</h1><p>使用 <strong>git log --author=<pattern></strong> 命令来查看某个作者的提交历史。</p><p>使用 <strong>git log --committer=<pattern></strong> 命令来查看某个提交者的提交历史。</p><p>查看 man git-log 对这两个选项的说明如下:</p><blockquote><p class="syl-line-pure-english"><strong>--author=<pattern>, --committer=<pattern></strong></p><p class="syl-line-pure-english">Limit the commits output to ones with author/committer header lines that match the specified pattern (regular expression). With more than one --author=<pattern>, commits whose author matches any of the given patterns are chosen (similarly for multiple --committer=<pattern>).</p></blockquote><p>即,所给的 pattern 参数可以用正则表达式来匹配特定模式。举例如下:</p><p>使用 <strong>git log --author=John</strong> 查看 John 的上库信息,如果有多个人名都带有 John,会匹配到多个人的提交历史。</p><p>使用 <strong>git log --author=john@xxxx.com</strong> 来查看 <strong>john@xxxx.com</strong> 这个邮箱的提交历史。</p><p>使用 <strong>git log --author=@xxxx.com</strong> 来查看 <strong>@xxxx.com </strong>这个邮箱后缀的提交历史。</p></div></div>

<div class="clearfix mb10">
        <div class="share fr">
        <div class="social-share mb20 ta-c" data-initialized="true">
            <a href="#" class="social-share-icon iconfont icon-weibo"></a>
            <a href="#" class="social-share-icon iconfont icon-qq"></a>
            <a href="#" class="social-share-icon iconfont icon-wechat"></a>
            <a href="#" class="social-share-icon iconfont icon-qzone"></a>
        </div>
        <script src="http://www.bigegpt.com/zb_users/theme/tx_hao/script/social-share.min.js"></script>
    </div>
    
        <div class="info-tag">
        <a href="http://www.bigegpt.com/tags-750.html" title="查看更多patchmatchnet内容" rel="tag" target="_blank">patchmatchnet</a>    </div>
    </div>



<div class="info-next">
    <ul class="row">
        <li class="col-12 col-m-24 mb10">上一篇:<a href="http://www.bigegpt.com/post/20317.html" title="A测版本泄露 现在你能够知道《战地1》中所有的武器名称">A测版本泄露 现在你能够知道《战地1》中所有的武器名称</a></li>
        <li class="col-12 col-m-24 ta-r mb10">下一篇:<a href="http://www.bigegpt.com/post/20319.html" title="OCP网络之Open vSwitch详解">OCP网络之Open vSwitch详解</a></li>
    </ul>
</div>

            </div>
            <h2 class="tx-title">相关推荐</h2>
            <div class="home-news">
                                                
<dl class="news-box clearfix pd20 ">
        <dt class="f-18 mb10"><a href="http://www.bigegpt.com/post/22493.html" title="php-fpm的配置和优化" class="f-black" target="_blank">php-fpm的配置和优化</a></dt>
    <dd class="news-txt">
        <p class="f-gray f-13">目录概述php-fpm配置php-fpm进程优化配置慢日志查询配置php7进阶到架构师相关阅读概述这是关于php进阶到架构之php7核心技术与实战学习的系列课程:php-fpm的配置和优化学习目标:理...</p>
    </dd>
    </dl>                                
<dl class="news-box clearfix pd20 ">
        <dt class="f-18 mb10"><a href="http://www.bigegpt.com/post/22492.html" title="成功安装 Magento2.4.3最新版教程「技术干货」" class="f-black" target="_blank">成功安装 Magento2.4.3最新版教程「技术干货」</a></dt>
    <dd class="news-txt">
        <p class="f-gray f-13">外贸独立站设计公司xingbell.com经过多次的反复实验,最新版的magento2.4.3在oneinstack的环境下的详细安装教程如下:一.vps系统:LinuxCentOS7.7.19...</p>
    </dd>
    </dl>                                
<dl class="news-box clearfix pd20 ">
        <dt class="f-18 mb10"><a href="http://www.bigegpt.com/post/22491.html" title="十分钟让你学会LNMP架构负载均衡" class="f-black" target="_blank">十分钟让你学会LNMP架构负载均衡</a></dt>
    <dd class="news-txt">
        <p class="f-gray f-13">业务架构、应用架构、数据架构和技术架构一、几个基本概念1、pv值pv值(pageviews):页面的浏览量概念:一个网站的所有页面,在一天内,被浏览的总次数。(大型网站通常是上千万的级别)2、u...</p>
    </dd>
    </dl>                                
<dl class="news-box clearfix pd20 ">
        <dt class="f-18 mb10"><a href="http://www.bigegpt.com/post/22490.html" title="php从远程URL获取(mp4 mp3)音视频的流媒体数据" class="f-black" target="_blank">php从远程URL获取(mp4 mp3)音视频的流媒体数据</a></dt>
    <dd class="news-txt">
        <p class="f-gray f-13">/***从远程URL中获取媒体(如mp4mp3)的内容*@parammixed$file_url*@parammixed$media_type...</p>
    </dd>
    </dl>                                
<dl class="news-box clearfix pd20 ">
        <dt class="f-18 mb10"><a href="http://www.bigegpt.com/post/22489.html" title="Zabbix5.0安装部署" class="f-black" target="_blank">Zabbix5.0安装部署</a></dt>
    <dd class="news-txt">
        <p class="f-gray f-13">全盘展示运行状态,减轻运维人员的重复性工作量,提高系统排错速度,加速运维知识学习积累。1.png1、环境安装关闭SELinux并重启系统2.png安装httpd、mariadb、php运行yum-...</p>
    </dd>
    </dl>                                
<dl class="news-box clearfix pd20 ">
        <dt class="f-18 mb10"><a href="http://www.bigegpt.com/post/22488.html" title="php 常见配置详解" class="f-black" target="_blank">php 常见配置详解</a></dt>
    <dd class="news-txt">
        <p class="f-gray f-13">以下是PHP常见的配置项及其含义:error_reporting:设置错误报告级别,可以控制PHP显示哪些错误。例如,设置为E_ALL将显示所有错误,而设置为0将禁止显示任何错误。displa...</p>
    </dd>
    </dl>                                
<dl class="news-box clearfix pd20 ">
        <dt class="f-18 mb10"><a href="http://www.bigegpt.com/post/22487.html" title="实践分享|基于基石智算 DeepSeek API + WordPress 插件自动生成访客回复" class="f-black" target="_blank">实践分享|基于基石智算 DeepSeek API + WordPress 插件自动生成访客回复</a></dt>
    <dd class="news-txt">
        <p class="f-gray f-13">基石智算举办的DeepSeek案例大赛汇集了不少基于CoresHubDeepSeekAPI服务或模型部署服务的精彩实践。本次我们将分享个人实践:通过DeepSeekAPI+Word...</p>
    </dd>
    </dl>                                
<dl class="news-box clearfix pd20 ">
        <dt class="f-18 mb10"><a href="http://www.bigegpt.com/post/22486.html" title="如何在Eclipse中搭建Zabbix源码的调试和开发环境" class="f-black" target="_blank">如何在Eclipse中搭建Zabbix源码的调试和开发环境</a></dt>
    <dd class="news-txt">
        <p class="f-gray f-13">Zabbix是一款非常优秀的企业级软件,被设计用于对数万台服务器、虚拟机和网络设备的数百万个监控项进行实时监控。Zabbix是开放源码和免费的,这就意味着当出现bug时,我们可以很方便地通过调试源码来...</p>
    </dd>
    </dl>                                
<dl class="news-box clearfix pd20 ">
        <dt class="f-18 mb10"><a href="http://www.bigegpt.com/post/22485.html" title="MySQL自我保护参数" class="f-black" target="_blank">MySQL自我保护参数</a></dt>
    <dd class="news-txt">
        <p class="f-gray f-13">#头条创作挑战赛#之前(MySQL自我保护工具--pt-kill)提到用pt-kill工具来kill相关的会话,来达到保护数据库的目的,本文再通过修改数据库参数的方式达到阻断长时间运行的SQL的目...</p>
    </dd>
    </dl>                                
<dl class="news-box clearfix pd20 ">
        <dt class="f-18 mb10"><a href="http://www.bigegpt.com/post/22484.html" title="Python闭包深度解析:掌握数据封装的高级技巧" class="f-black" target="_blank">Python闭包深度解析:掌握数据封装的高级技巧</a></dt>
    <dd class="news-txt">
        <p class="f-gray f-13">闭包作为Python高级编程特性之一,为开发者提供了一种优雅的方式来实现数据封装和状态保持。这一概念源于函数式编程理论,在现代Python开发中发挥着重要作用。理解和掌握闭包的使用不仅能够提升代码的表...</p>
    </dd>
    </dl>                                
<dl class="news-box clearfix pd20 ">
        <dt class="f-18 mb10"><a href="http://www.bigegpt.com/post/22483.html" title="Java服务网格故障注入与熔断实战" class="f-black" target="_blank">Java服务网格故障注入与熔断实战</a></dt>
    <dd class="news-txt">
        <p class="f-gray f-13">在分布式系统的高可用性挑战中,服务网格的故障注入与熔断机制是检验系统韧性的终极试金石。以下是10道逐步升级的"地狱关卡",每个关卡都对应真实生产环境中可能遇到的致命场景,并附具体场景示...</p>
    </dd>
    </dl>                                
<dl class="news-box clearfix pd20 ">
        <dt class="f-18 mb10"><a href="http://www.bigegpt.com/post/22482.html" title="MySQL数据库性能优化全攻略:程序员必知的七大核心策略" class="f-black" target="_blank">MySQL数据库性能优化全攻略:程序员必知的七大核心策略</a></dt>
    <dd class="news-txt">
        <p class="f-gray f-13">作为程序员,我们每天都要与数据库打交道。当系统用户量突破百万级时,数据库往往成为性能瓶颈的首要怀疑对象。本文将深入探讨MySQL优化的七大核心策略,并提供可直接落地的优化方案,助您构建高效稳定的数据库...</p>
    </dd>
    </dl>                                
<dl class="news-box clearfix pd20 ">
        <dt class="f-18 mb10"><a href="http://www.bigegpt.com/post/22481.html" title="如何在 Windows 11 上使用单个命令安装 XAMPP" class="f-black" target="_blank">如何在 Windows 11 上使用单个命令安装 XAMPP</a></dt>
    <dd class="news-txt">
        <p class="f-gray f-13">XAMPP是一种广泛使用的软件,用于在Windows操作系统上快速运行LAMP服务器包,包括Windows11。尽管LAMP通常用于Linux系统,但XAMPP并不使用Li...</p>
    </dd>
    </dl>                                
<dl class="news-box clearfix pd20 ">
        <dt class="f-18 mb10"><a href="http://www.bigegpt.com/post/22480.html" title="uTorrent怎样将bt种子转换为磁力" class="f-black" target="_blank">uTorrent怎样将bt种子转换为磁力</a></dt>
    <dd class="news-txt">
        <p class="f-gray f-13">如何用uTorrent把BT种子转为磁力链接?以下方法希望能帮到你。1、在uTorrent窗口里,点击工具栏的按钮,所示。2、在打开窗口里,选取要转为磁力的种子文件,然后点击打开按钮,参照图示操作...</p>
    </dd>
    </dl>                                
<dl class="news-box clearfix pd20 ">
        <dt class="f-18 mb10"><a href="http://www.bigegpt.com/post/22479.html" title="支持向量机SVM 分类和回归的实例" class="f-black" target="_blank">支持向量机SVM 分类和回归的实例</a></dt>
    <dd class="news-txt">
        <p class="f-gray f-13">支持向量机(SupportVectorMachine)是Cortes和Vapnik于1995年首先提出的,它在解决小样本、非线性及高维模式识别中表现出许多特有的优势,并能够推广应用到函数拟合等其他...</p>
    </dd>
    </dl>                
            </div>

            
        </div>

                <div class="side-box col-6 col-m-24 col2-">
                                    <dl class="side-hot">
                <dt>一周热门</dt>
                <dd>
                    <ul>
                                                <li>
                            <a href="http://www.bigegpt.com/post/8583.html" title="idea本地配置连接远程hadoop集群的一些网络问题解决汇总" target="_blank">
                                                                <h2 class="f-15">idea本地配置连接远程hadoop集群的一些网络问题解决汇总</h2>
                            </a>
                        </li>
                                                <li>
                            <a href="http://www.bigegpt.com/post/20064.html" title="无缓存不行?例行升级的入门级阿斯加特AN2 SSD装机点评" target="_blank">
                                                                <i><span class="img-box" data-ratio="16:9"><img src="https://p3-sign.toutiaoimg.com/pgc-image/6d7450e4893f4e908f4a82cce9294129~tplv-tt-origin-web:gif.jpeg?_iz=58558&from=article.pc_detail&lk3s=953192f4&x-expires=1738736907&x-signature=wWNqCl%2FITbxmHFW4g42vXCmtwwY%3D" alt="无缓存不行?例行升级的入门级阿斯加特AN2 SSD装机点评"></span></i>
                                                                <h2 class="f-15">无缓存不行?例行升级的入门级阿斯加特AN2 SSD装机点评</h2>
                            </a>
                        </li>
                                                <li>
                            <a href="http://www.bigegpt.com/post/19634.html" title="Ceph运维手册(基于P版本)" target="_blank">
                                                                <h2 class="f-15">Ceph运维手册(基于P版本)</h2>
                            </a>
                        </li>
                                                <li>
                            <a href="http://www.bigegpt.com/post/8582.html" title="大数据开发前要做什么准备?8台Hadoop服务器进行集群规划前配置" target="_blank">
                                                                <h2 class="f-15">大数据开发前要做什么准备?8台Hadoop服务器进行集群规划前配置</h2>
                            </a>
                        </li>
                                                <li>
                            <a href="http://www.bigegpt.com/post/12199.html" title="Tensorflow分类loss函数总结 tensorflow绘制loss曲线" target="_blank">
                                                                <h2 class="f-15">Tensorflow分类loss函数总结 tensorflow绘制loss曲线</h2>
                            </a>
                        </li>
                                                <li>
                            <a href="http://www.bigegpt.com/post/19094.html" title="R语言学习笔记(七) -离散型数据的模型预测2" target="_blank">
                                                                <h2 class="f-15">R语言学习笔记(七) -离散型数据的模型预测2</h2>
                            </a>
                        </li>
                                                <li>
                            <a href="http://www.bigegpt.com/post/8645.html" title="iOS Runtime详解" target="_blank">
                                                                <h2 class="f-15">iOS Runtime详解</h2>
                            </a>
                        </li>
                                                <li>
                            <a href="http://www.bigegpt.com/post/9107.html" title="7 个对 Java 意义重大的性能指标,你知道几个?" target="_blank">
                                                                <h2 class="f-15">7 个对 Java 意义重大的性能指标,你知道几个?</h2>
                            </a>
                        </li>
                                                <li>
                            <a href="http://www.bigegpt.com/post/6669.html" title="Laravel框架使用图片处理简单教程" target="_blank">
                                                                <h2 class="f-15">Laravel框架使用图片处理简单教程</h2>
                            </a>
                        </li>
                                                <li>
                            <a href="http://www.bigegpt.com/post/6593.html" title="PHP 远程调试最佳实践" target="_blank">
                                                                <h2 class="f-15">PHP 远程调试最佳实践</h2>
                            </a>
                        </li>
                                            </ul>
                </dd>
            </dl>
            
            

<dl class="function" id="divPrevious">
<dt class="function_t">最近发表</dt><dd class="function_c">


<ul><li><a title="php-fpm的配置和优化" href="http://www.bigegpt.com/post/22493.html">php-fpm的配置和优化</a></li>
<li><a title="成功安装 Magento2.4.3最新版教程「技术干货」" href="http://www.bigegpt.com/post/22492.html">成功安装 Magento2.4.3最新版教程「技术干货」</a></li>
<li><a title="十分钟让你学会LNMP架构负载均衡" href="http://www.bigegpt.com/post/22491.html">十分钟让你学会LNMP架构负载均衡</a></li>
<li><a title="php从远程URL获取(mp4 mp3)音视频的流媒体数据" href="http://www.bigegpt.com/post/22490.html">php从远程URL获取(mp4 mp3)音视频的流媒体数据</a></li>
<li><a title="Zabbix5.0安装部署" href="http://www.bigegpt.com/post/22489.html">Zabbix5.0安装部署</a></li>
<li><a title="php 常见配置详解" href="http://www.bigegpt.com/post/22488.html">php 常见配置详解</a></li>
<li><a title="实践分享|基于基石智算 DeepSeek API + WordPress 插件自动生成访客回复" href="http://www.bigegpt.com/post/22487.html">实践分享|基于基石智算 DeepSeek API + WordPress 插件自动生成访客回复</a></li>
<li><a title="如何在Eclipse中搭建Zabbix源码的调试和开发环境" href="http://www.bigegpt.com/post/22486.html">如何在Eclipse中搭建Zabbix源码的调试和开发环境</a></li>
<li><a title="MySQL自我保护参数" href="http://www.bigegpt.com/post/22485.html">MySQL自我保护参数</a></li>
<li><a title="Python闭包深度解析:掌握数据封装的高级技巧" href="http://www.bigegpt.com/post/22484.html">Python闭包深度解析:掌握数据封装的高级技巧</a></li>
</ul>

</dd>
</dl>
<dl class="function" id="divTags">
<dt class="function_t">标签列表</dt><dd class="function_c">


<ul><li><a title="mybatiscollection" href="http://www.bigegpt.com/tags-5.html">mybatiscollection<span class="tag-count"> (79)</span></a></li>
<li><a title="mqtt服务器" href="http://www.bigegpt.com/tags-7.html">mqtt服务器<span class="tag-count"> (88)</span></a></li>
<li><a title="keyerror" href="http://www.bigegpt.com/tags-11.html">keyerror<span class="tag-count"> (78)</span></a></li>
<li><a title="c#map" href="http://www.bigegpt.com/tags-12.html">c#map<span class="tag-count"> (65)</span></a></li>
<li><a title="resize函数" href="http://www.bigegpt.com/tags-15.html">resize函数<span class="tag-count"> (64)</span></a></li>
<li><a title="xftp6" href="http://www.bigegpt.com/tags-16.html">xftp6<span class="tag-count"> (83)</span></a></li>
<li><a title="bt搜索" href="http://www.bigegpt.com/tags-23.html">bt搜索<span class="tag-count"> (75)</span></a></li>
<li><a title="c#var" href="http://www.bigegpt.com/tags-24.html">c#var<span class="tag-count"> (76)</span></a></li>
<li><a title="mybatis大于等于" href="http://www.bigegpt.com/tags-30.html">mybatis大于等于<span class="tag-count"> (64)</span></a></li>
<li><a title="xcode-select" href="http://www.bigegpt.com/tags-35.html">xcode-select<span class="tag-count"> (66)</span></a></li>
<li><a title="mysql授权" href="http://www.bigegpt.com/tags-37.html">mysql授权<span class="tag-count"> (74)</span></a></li>
<li><a title="下载测试" href="http://www.bigegpt.com/tags-39.html">下载测试<span class="tag-count"> (70)</span></a></li>
<li><a title="skip-name-resolve" href="http://www.bigegpt.com/tags-42.html">skip-name-resolve<span class="tag-count"> (63)</span></a></li>
<li><a title="linuxlink" href="http://www.bigegpt.com/tags-48.html">linuxlink<span class="tag-count"> (65)</span></a></li>
<li><a title="httperror403.14-forbidden" href="http://www.bigegpt.com/tags-223.html">httperror403.14-forbidden<span class="tag-count"> (63)</span></a></li>
<li><a title="logstashinput" href="http://www.bigegpt.com/tags-320.html">logstashinput<span class="tag-count"> (65)</span></a></li>
<li><a title="hadoop端口" href="http://www.bigegpt.com/tags-340.html">hadoop端口<span class="tag-count"> (65)</span></a></li>
<li><a title="vue阻止冒泡" href="http://www.bigegpt.com/tags-501.html">vue阻止冒泡<span class="tag-count"> (67)</span></a></li>
<li><a title="oracle时间戳转换日期" href="http://www.bigegpt.com/tags-518.html">oracle时间戳转换日期<span class="tag-count"> (64)</span></a></li>
<li><a title="jquery跨域" href="http://www.bigegpt.com/tags-523.html">jquery跨域<span class="tag-count"> (68)</span></a></li>
<li><a title="php写入文件" href="http://www.bigegpt.com/tags-546.html">php写入文件<span class="tag-count"> (73)</span></a></li>
<li><a title="kafkatools" href="http://www.bigegpt.com/tags-578.html">kafkatools<span class="tag-count"> (66)</span></a></li>
<li><a title="mysql导出数据库" href="http://www.bigegpt.com/tags-602.html">mysql导出数据库<span class="tag-count"> (66)</span></a></li>
<li><a title="jquery鼠标移入移出" href="http://www.bigegpt.com/tags-603.html">jquery鼠标移入移出<span class="tag-count"> (71)</span></a></li>
<li><a title="取小数点后两位的函数" href="http://www.bigegpt.com/tags-605.html">取小数点后两位的函数<span class="tag-count"> (73)</span></a></li>
</ul>

</dd>
</dl>
        </div>
            </div>
</div>



</div>
<div class="footer">
    <div class="wide ta-c f-12">
                    </div>
</div>


<div class="fixed-box ">
    <ul>
        <li class="pchide wapflex"><a href="http://www.bigegpt.com/"><i class="fa fa-home"></i> 首页</a></li>
                        <li><a href="http://www.bigegpt.com/shoulu.html" title="收录申请" target="_blank"><i class="fa fa-chain-broken mr5"></i>收录</a></li>
                                <li><span class="gotop"><i class="fa fa-caret-up mr5"></i> 顶部</span></li>
    </ul>
</div>
<script src="http://www.bigegpt.com/zb_users/theme/tx_hao/script/txcstx.min.js?v=2024-12-04"></script>
</body>
</html><!--656.65 ms , 13 queries , 3782kb memory , 0 error-->