git:每日更新日志
如何生成按日期分组的提交的变更日志,格式为:
[date today]
- commit message1
- commit message2
- commit message3
...
[date day+3]
- commit message1
- commit message2
- commit message3
...
(skip this day if no commits)
[date day+1]
- commit message1
- commit message2
- commit message3
...
[date since]
- commit message1
- commit message2
- commit message3
任何 git log 命令或智能 bash 脚本?
How to generate changelog of commits groupped by date, in format:
[date today]
- commit message1
- commit message2
- commit message3
...
[date day+3]
- commit message1
- commit message2
- commit message3
...
(skip this day if no commits)
[date day+1]
- commit message1
- commit message2
- commit message3
...
[date since]
- commit message1
- commit message2
- commit message3
Any git log command, or smart bash script?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
这是我想出的脚本的肮脏但有效的版本:
Here is dirty, but working version of the script I came up with:
我无法得到处理今天提交的可接受的答案,因为我的设置在第一次迭代时没有正确处理 NEXT 变量。 Git 的日志参数也接受时间,这样就不需要 NEXT 日期:
I couldn't get the accepted answer to handle today's commits as my setup didn't handle the NEXT variable properly on the first iteration. Git's log parameters will accept a time too, which removes the need for a NEXT date:
git log
有--since
和--until
,围绕它包装一些东西应该不难。git log
has--since
and--until
, it shouldn't be hard to wrap some stuff around that.这肯定需要某种脚本。
有点像这样 commandline-fu
(不完全是你想要的,但仍然可以给你一个想法)
我知道GitStats 也包含按日期组织的数据(但不是提交消息)
注意:此命令的
gitbranch
部分是不适合脚本编写,如 Jakub Narębski 评论。git for-each-ref
或git show-ref
是脚本命令的自然候选者,是管道命令。That would require most certainly some kind of script.
A bit like this commandline-fu
(not exactly what you are after but can gives you an idea nonetheless)
I know about GitStats which has also data organized by date (but not the commit messages)
Note: the
git branch
part of this command is ill-fitted for scripting, as Jakub Narębski comments.git for-each-ref
orgit show-ref
are natural candidate for scripting commands, being plumbing commands.我用 python 编写了一个脚本来创建每周的 git 日志。
您可以通过更改时间增量轻松将其更改为天、月等
https://gist.github.com/纳希姆纳赛尔/4772132
I wrote a script in python to create a week-by-week git log.
You could easily change it to days, months, etc by changing the timedelta
https://gist.github.com/NahimNasser/4772132