向 git commit 添加额外参数
我们有一个定制的系统来跟踪客户任务/项目。我们手动添加一个清单并将其标记出来,通常还会添加每个点所花费的时间。这非常有用,但有点多余,因为我们也在 git 中提供了相同的信息。所以我正在考虑以某种方式向 git 添加一个额外的参数,让我能够指示某件事花费了多长时间,然后提取该数据并将其保存在数据库中(我们通常使用 PHP/MySQL)。人们会怎样做呢?
我想到这样做:
git commit -m "Adding search function" 15
然后以某种方式能够提取 15(分钟)以供稍后处理,以及此任务的描述,以便我们不必添加单独花费 15 分钟的“添加搜索功能”。我正在考虑一个挂钩,它接受第二个参数并将其用作要传递给 PHP 脚本的变量。这可行吗?
We have a custom-made system to track client tasks/projects. We manually add a checklist and mark them off, often also adding the time it took for each point. This is very useful but a bit redundant, as we also provide the same information in git. So I'm thinking of somehow adding an extra parameter to git that allows me to indicate how long something took, and then extract this data and save it in a database (we normally use PHP/MySQL). How would one go about this?
I think of doing:
git commit -m "Adding search functionality" 15
And then somehow being able to extract the 15 (minutes) to process it later on, together with the description of this task, so that we do not have to add "Adding search functionality" which took 15 minutes separately. I'm thinking of a hook that takes this second parameter and uses it as a variable to be passed on to a PHP script. Is this feasible?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可以将自定义参数集成到提交消息本身中,然后稍后解析它
,或者
现在可以很容易地找到
[]
并解析其中的值。Github、redmine、bitbucket(等等)在将提交链接到问题时会执行类似的操作,反之亦然。
无论如何,您应该考虑使用真正的错误/问题跟踪器而不是“清单”。
You can integrate your custom arguments into the commit message itself and then parse this later
or maybe
Now its quite easy to find
[]
and parse the values within.Github, redmine, bitbucket (and so on) does something similar, when they link commits to issues and vice versa
You should think about using a real bug/issue tracker instead of "a checklist" anyway.
通常这些东西会被添加到提交消息本身,然后提取(钩子、脚本、错误跟踪器等)。
您还可以使用 git Notes 来查看(您甚至可以添加它们而无需重写现有提交),但是唯一的问题是共享它们,这不是很简单。
http://progit.org/2010/08/25/notes.html
Usually such things are added to the commit messages itself and then extracted ( hooks, scripts, bugtrackers etc.)
You can also look at using
git notes
( you can even add them without rewriting existing commits) , but the only problem is in sharing them, which is not very straightforward.http://progit.org/2010/08/25/notes.html