git 提交指标
我想使用 bash 脚本确定 git 提交指标。
但我从不使用 bash 脚本。
这个想法是在特定时间段内未在其状态中引用的提交数量
(即:未关闭或没有#nnnn
引用,其中n
是一个数字,因为我们使用Redmine来显示开放提交的引用)
算法是:
fonction (initial date, final date)
read initial date
read final date
int n=0
while (initial date<date<final date) do
if (status!=closed or status!= #nnnn) //where #nnnn is a reference and n a number
n=+1
end if
end while
echo "the number of none referenced commit is"
echo n
return 0
如果有一个具体的git命令或者其他想法,请留下回复,这对我有很大帮助。谢谢
I want to determine git commit metrics using bash script.
But I never use bash script.
The idea is to have the number of commit wich are not referenced in their status during a specific time
(i.e.: not closed or no #nnnn
reference where n
is a number, because we use Redmine to show the reference of open commit)
the algorithm is:
fonction (initial date, final date)
read initial date
read final date
int n=0
while (initial date<date<final date) do
if (status!=closed or status!= #nnnn) //where #nnnn is a reference and n a number
n=+1
end if
end while
echo "the number of none referenced commit is"
echo n
return 0
If there is a specific git command or other idea, please leave a response, it will help me a lot. thank you
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
这样的脚本将使用和利用 git 低级命令(管道,适合脚本编写)命令
git rev-list
:提交限制选项允许您定义一个范围日期,并选择正确的日志消息:
提交格式选项允许您仅显示您需要的内容,主要是提交的注释,供您解析(我想您在提交的注释中存储了所述状态)提交,尽管您也可以使用
git Notes
< /a>):Such a script would use and exploit the git low-level commands (plumbing, suitable for scripting) command
git rev-list
:The commit limiting options allow you to define a range of date, and to select the right log message:
The commit formatting options allow you to display only what you need, mainly the comment of the commit, for you to parse (I suppose it is in the comment of a commit that you have stored the status of said commit, although you could also have used
git notes
):更新评论后:
看来您确实受益于更简单地
从提交消息中过滤出常见模式。如果您想要一个计数,
您可以从原始答案标志中添加以减少 git log 的输出,就像这样
原始答案:
再来一次。这个问题不解析。 “其状态中未提及” 什么状态?提交通常没有提交。您使用提交注释吗?
我的印象是,您想要查找特定时间段内 git 提交消息中未提及的某些信息?如果是这样,请举例说明您使用哪种提交消息,以及如何存储要查找的“关系 ID”列表。例如:
当然,您应该根据您的需求进行混合和匹配,根据您的喜好更改输出。如果您愿意,
from
/until
当然可以是绝对日期文字。Update After the comments:
It seems you really are helped by the much simpler
filtering out just common patterns from commit messages. If you wanted a count of that
You can add from the original answer flags to reduce the output of
git log
, like soOriginal answer:
Come again. This question does not parse. "wich are not referenced in their status" What status? A commit doesn't normally have one. Are you using commit notes?
I'm getting the impression you want to find certain information that was not mentioned in git commit messages during a specific period of time? If so, give examples of what kind of commit messages you use, and how the list of 'relation ids' to look for is stored. E.g.:
Of course you should mix and match to your needs, altering the output to your liking.
from
/until
can of course be absolute date literals if you like.