在 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
get all the commits done by me in the last 5 days in git
提问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 roger
is your username.
尝试git log --since=5.days --author=roger
,假设这roger
是您的用户名。
--author
actually accepts a regular expression, so if you wanted to find either roger
or rachel
's commits, you could do git log --since=5.days --author="r(oger|achel)"
.
--author
实际上接受一个正则表达式,所以如果你想找到roger
orrachel
的提交,你可以做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 --author
flag 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 log
default output, you can play around with the formatting options a bit. git log --since=5.days --oneline
will 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=%H
will 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 哈希值。