在 git 中获取我在过去 5 天内完成的所有提交

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/2009577/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-19 04:00:13  来源:igfitidea点击:

get all the commits done by me in the last 5 days in git

gitcommand-line

提问by Roger

I am not very good at sed or awk. Every friday I'd like to see all the commits done by me in the last 5 days, to find out what work I did.

我不太擅长 sed 或 awk。每个星期五我都想查看我在过去 5 天内所做的所有提交,以了解我所做的工作。

At this time the only command I know of is

此时我所知道的唯一命令是

git log --since=5.days

回答by John Feminella

Try git log --since=5.days --author=roger, assuming that rogeris your username.

尝试git log --since=5.days --author=roger,假设这roger是您的用户名。

--authoractually accepts a regular expression, so if you wanted to find either rogeror rachel's commits, you could do git log --since=5.days --author="r(oger|achel)".

--author实际上接受一个正则表达式,所以如果你想找到rogerorrachel的提交,你可以做git log --since=5.days --author="r(oger|achel)".

回答by Paul McMahon

Git supports searching based on the author as well

Git 也支持基于作者的搜索

git log --since=5.days --author=Roger

回答by mipadi

To limit commits to yourself, pass the --authorflag to git log, as in git log --since=5.days --author='Your Name'.

要限制对自己的提交,请将--author标志传递给git log,如git log --since=5.days --author='Your Name'

If you want lessinformation than the git logdefault output, you can play around with the formatting options a bit. git log --since=5.days --onelinewill show you a one-line summary of each commit from the past 5 days (the one-line summary will contain the abbreviated SHA1 hash of the commit as well as the first line of the log message). Or git log --since=5.days --format=%Hwill show onlythe fullSHA1 hash of the commits from the past 5 days.

如果你想比信息git log默认输出,你可以玩的格式选项位。git log --since=5.days --oneline将向您显示过去 5 天内每次提交的一行摘要(一行摘要将包含提交的缩写 SHA1 哈希值以及日志消息的第一行)。或者git log --since=5.days --format=%H显示过去 5 天提交的完整SHA1 哈希值。