Git:git-log的用法总结

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

前言

本篇总结一下git-log的用法,不过以前的总结方式是通篇的翻译,这样感觉非常耽误时间,缺乏实际的效率,这篇文章尝试改进一下。
改进的思路是,先总结最常用的参数,然后逐步完善次常用的,再总结次常用的。

正文

git-log主要是用来显示提交日志的。

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 rev-list同样的参数来控制什么来显示和如何来显示,接受git diff-*的参数来控制每个commit引入的改变是如何被显示的。

git log -p

这个是我最常用的命令,p参数其实是patch的缩写,是补丁方式来显示。
在这里插入图片描述
-1表示只看一个提交。

git log --pretty[=<format>]

用给定的格式显示提交的信息。
在这里插入图片描述
oneline是紧凑模式,只用一行来显示。

git log --stat

生成一个diffstat。
在这里插入图片描述

总结

git-log使用比较广泛,需要慢慢总结。

参考

https://git-scm.com/docs/git-log

猜你喜欢

转载自blog.csdn.net/chaiyu2002/article/details/86679616