列出两个日期之间的 git 提交到 master 分支
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/27313309/
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
List git commits to master branch between two dates
提问by Aksel Willgert
How can i get a list of all the git commits done to the master branch between 2014-01-01 and 2014-06-30?
如何获取 2014-01-01 和 2014-06-30 之间对 master 分支所做的所有 git 提交的列表?
I know git log
will give me roughly this format (repeated for all commits):
我知道git log
会给我大致这种格式(对所有提交重复):
commit <hash>
author: <author name>
date: <date>
<comment>
But how can it be limited to selected dates and a one line per commit format?
但是如何将其限制为选定的日期和每个提交格式的一行呢?
<hash> <author> <date>
<hash> <author> <date>
回答by Tim
$ git log --since "DEC 1 2014" --until "DEC 5 2014" --pretty=format:"%h %an %ad"
This will give the format you want for the commits between dec 1 2014 and dec 5 2014, you can change the dates as you like
这将为您提供 2014 年 12 月 1 日和 2014 年 12 月 5 日之间提交所需的格式,您可以根据需要更改日期
If you wish to change the format, you can read about the options here
如果您想更改格式,可以在此处阅读有关选项的信息
回答by shirakia
$ git log master --pretty="%h %an %ad" --since=2014-01-01 --until=2014-06-30
Here is everything http://git-scm.com/docs/git-log
回答by Bhavya Shaktawat
Have you tried
你有没有尝试过
git whatchanged --since="2 year ago" --until="1 year ago" [--author="NAME_OF_THE_AUTHOR"]
Even git log
can be utilized to have this result. There are some advance options available in git log
甚至git log
可以用来得到这个结果。有一些高级选项可用git log
git log --after="2014-7-1" --before="2014-7-4"
For more details about advance git log you can refer to this link
有关高级 git log 的更多详细信息,您可以参考此链接
回答by 4rlekin
Well, this should do the trick:
好吧,这应该可以解决问题:
git log --oneline since="1/1/2014" --until="30/6/2014"