向 git commit 添加额外参数

发布于 2024-12-08 21:26:53 字数 378 浏览 0 评论 0原文

我们有一个定制的系统来跟踪客户任务/项目。我们手动添加一个清单并将其标记出来,通常还会添加每个点所花费的时间。这非常有用,但有点多余,因为我们也在 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

阳光①夏 2024-12-15 21:26:53

您可以将自定义参数集成到提交消息本身中,然后稍后解析它

git commit -m "foo [15min]"

,或者

git commit -m "bar [00:00:15]"

现在可以很容易地找到 [] 并解析其中的值。

Github、redmine、bitbucket(等等)在将提交链接到问题时会执行类似的操作,反之亦然。

git commit -m "Fixed bug [Closes #42]"

无论如何,您应该考虑使用真正的错误/问题跟踪器而不是“清单”。

You can integrate your custom arguments into the commit message itself and then parse this later

git commit -m "foo [15min]"

or maybe

git commit -m "bar [00:00:15]"

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

git commit -m "Fixed bug [Closes #42]"

You should think about using a real bug/issue tracker instead of "a checklist" anyway.

计㈡愣 2024-12-15 21:26:53

通常这些东西会被添加到提交消息本身,然后提取(钩子、脚本、错误跟踪器等)。

您还可以使用 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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文