原作者:Srebalaji
原文地址:Ten Useful Git Log Tricks | Hacker Noon
译者:KIWI 的碎碎念
If you are using Git for a while you should have come across git log. As everyone knows, the git log is a simple command that helps us to view the changes or project history.
(如果你在使用 Git 一段时间后,应该会遇到访问 git 日志的场景。众所周知,git log 是一个帮助我们查看项目变更或项目历史的简单命令。)
Even with that simplicity, it is a very powerful tool and it comes with numerous options that help us to view the project changes and its structure. We will see some of the most used options in this article.
(尽管它是非常简单的,但是它是一个非常强大的命令工具,可以通过它提供的数量众多的选项来帮助我们去查看项目的变更与结构。在这篇文章里,我们将看到一些它最常使用的选项)
git log —oneline
This command helps you to view the commits in a cleaner way. It condenses each commit to a line and has only minimal information like shorter commit hash, commit message.
(这条命令可以帮助你以简洁的方式查看提交记录。它把提交记录浓缩在了一行,而且只保留类似较短的提交哈希值和提交信息)
git log --oneline
Filter commits by time period
(根据时间段筛选提交信息)
These commands will filter out the commits by the given time period. For example, — after will only filter commits after the given time period and — before will only filter commits before the given time period.
(这些命令可以筛选出指定时间段的提交记录,例如,--after 会筛选出指定时间之后的提交记录,*--before * 会筛选出指定时间之前的提交记录。)