git log 帮助文档01

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/guitarrain/article/details/81259606

名称

git-log -显示提交记录

摘要

git log [<options>][<revision range>][[–]<path>…]


概述

显示提交记录.
该命令通过适用于git rev-list命令的选项来控制显示什么以及如何显示.并且通过适用于git diff-*命令的选项来控制如何显示每次提交的变化.
原文是这样的:
The command takes options applicable to the git rev-list command to control what is shown and how, and options applicable to the git diff-* commands to control how the changes each commit introduces are shown.

这段我理解了半天.在git bash 中输入git rev-list可得到如下输出:

图中列出的参数都是可供git log 使用的,并且对参数做了分类:
1. 限制输出
2. 定向输出
3. 格式化输出
4. 特殊用途

我们拿–no-merges验证一下:

很明显的,在使用–no-merges得到的输出结果中,merge记录并未显示出来.

另一个参数来源git diff-是通配符,比如git diff-tree.

OPTIONS

–follow
Continue listing the history of a file beyond renames (works only for a single file).
本人英语较烂,不理解这个beyond renams是什么意思.于是对一个java类重命名做实验.过程是这样的:
1. 将Java类A重命名为B,并作提交;
2. git log – A;git log –follow – A;
3. 以上两条命令都能输出A文件完整提交记录,包括重命名为B的记录;
4. git log – B;git log –follow – B;
5. 还是以上两条命令,将文件名换成重命名后的B(Rename),有意思的事情发生了:


大家自己动手实验下.
这时再回头看beyong renames就很好理解了.加上–follow参数后,显示的提交记录已经超出了新命名的范畴,将老文件名的记录一起展示出来了.

目前为止,才看到git log文档的前几行.但已收获颇丰.决定搞一个硬着头皮看文档系列啦!!!希望大家监督!

猜你喜欢

转载自blog.csdn.net/guitarrain/article/details/81259606