translated

This commit is contained in:
chai001125 2022-11-01 10:09:31 +08:00
parent 9055ad82e6
commit 1a8fdd73f1
2 changed files with 66 additions and 66 deletions

View File

@ -1,66 +0,0 @@
[#]: subject: "How to display commits created on a specific day with the git log command"
[#]: via: "https://opensource.com/article/22/10/git-log-command"
[#]: author: "Agil Antony https://opensource.com/users/agantony"
[#]: collector: "lkxed"
[#]: translator: "chai001125"
[#]: reviewer: " "
[#]: publisher: " "
[#]: url: " "
How to display commits created on a specific day with the git log command
======
The git log command is an important reporting tool and yet another reason to use Git.
The `git log` command offers many opportunities to learn more about the commits made by contributors. One way you might consume such information is by date. To view commits in a Git repository created on a specific date or range of dates, use the `git log` command with the options `--since` or `--until`, or both.
First, checkout the branch you want to inspect (for example, `main`):
```
$ git checkout main
```
Next, display the commits for the current date (today):
```
$ git log--oneline--since="yesterday"
```
Display commits for the current date by a specific author only (for example, `Agil`):
```
$ git log--oneline--since="yesterday"--author="Agil"
```
You can also display results for a range of dates. Display commits between any two dates (for example, 22 April 2022 and 24 April 2022):
```
$ git log--oneline--since="2022-04-22"--until="2022-04-24"
```
In this example, the output displays all the commits between 22 April 2022 and 24 April 2022, which excludes the commits done on 22 April 2022. If you want to include the commits done on 22 April 2022, replace `2022-04-22` with `2022-04-21`.
Run the following command to display commits between any two dates by a specific author only (for example, `Agil`):
```
$ git log--oneline--since="2022-04-22" \--until="2022-04-24"--author="Agil"
```
### Reporting
Git has many advantages, and one of them is the way it enables you to gather data about your project. The `git log` command is an important reporting tool and yet another reason to use Git!
--------------------------------------------------------------------------------
via: https://opensource.com/article/22/10/git-log-command
作者:[Agil Antony][a]
选题:[lkxed][b]
译者:[译者ID](https://github.com/译者ID)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://opensource.com/users/agantony
[b]: https://github.com/lkxed

View File

@ -0,0 +1,66 @@
[#]: subject: "How to display commits created on a specific day with the git log command"
[#]: via: "https://opensource.com/article/22/10/git-log-command"
[#]: author: "Agil Antony https://opensource.com/users/agantony"
[#]: collector: "lkxed"
[#]: translator: "chai001125"
[#]: reviewer: " "
[#]: publisher: " "
[#]: url: " "
用 git log 命令显示在特定日期的提交记录
======
`git log` 命令是 Git 中一个很重要的查看提交记录的工具,它也是人们喜欢使用 Git 的原因之一。
`git log` 命令能够让你了解到更多关于贡献者 <ruby>提交<rt> commit </rt> </ruby> 的记录。使用 `git log` 的一种方式是按日期查看提交记录 。要查看**在指定日期或日期范围内**创建的 Git 存储库中的提交记录,请使用带有选项 `--since``--until` 或者同时使用以上两个选项的 `git log` 命令。
首先,进入你要查看的分支(例如,`main` 分支):
```
$ git checkout main
```
接下来,你可以使用以下命令,来显示当前日期(即今天)的提交记录:
```
$ git log --oneline --since="yesterday"
```
仅显示某一特定用户(例如,用户 `Agil`)在今天的提交记录:
```
$ git log --oneline --since="yesterday" --author="Agil"
```
还可以显示在某一日期范围内的提交记录。使用以下命令显示在任意两个日期之间例如2022 年 4 月 22 日至 2022 年 4 月 24 日)的提交记录:
```
$ git log --oneline --since="2022-04-22" --until="2022-04-24"
```
在上面这个例子中,会输出 2022 年 4 月 22 日至 2022 年 4 月 24 日期间,不包括 2022 年 4 月 22 日的所有提交记录。如果你想要包括 2022 年 4 月 22 日的提交记录,请将命令中的 `2022-04-22` 替换为 `2022-04-21`
运行以下命令,能够显示某一特定用户(例如,用户 `Agil`)在两个指定的日期之间的提交记录:
```
$ git log --oneline --since="2022-04-22" --until="2022-04-24" --author="Agil"
```
### 总结
Git 有很多优点,其中一个优点就是 Git 让你能够收集你项目的相关数据。`git log` 命令是一个重要的查看提交记录的工具,也是人们喜欢使用 Git 的原因之一!
--------------------------------------------------------------------------------
via: https://opensource.com/article/22/10/git-log-command
作者:[Agil Antony][a]
选题:[lkxed][b]
译者:[chai001125](https://github.com/chai001125)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://opensource.com/users/agantony
[b]: https://github.com/lkxed