您可以在提交项目之前获取下一个提交ID吗? [英] Can you get the next commit id before items are commited?

查看:67
本文介绍了您可以在提交项目之前获取下一个提交ID吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我当前正在添加一个commit-msg钩子,该钩子会将git commit URL作为注释添加到Jira. 提交网址的格式为

I'm currently adding a commit-msg hook that will add the git commit URL as a comment to Jira. The commit URL has the format

http://[server]/[group]/[project]/commit/[commit_id]

是否可以获取提交ID,或者仅在提交项目后才生成?这是否意味着我需要在以后的钩子中实现它?

Is it possible to obtain the commit id or is it only produced after the item has been committed? Does this mean I need to implement this in a later hook?

推荐答案

git提交ID是以下项的SHA-1哈希:

A git commit id is a SHA-1 hash of:

  • 提交消息
  • 作者和提交者信息
  • 日期
  • 内容(树的哈希)
  • 父提交哈希(或哈希,用于合并)

因此,提交ID只能在提交该项目后产生.

So, the commit id can only be produced after the item has been committed.

这篇关于您可以在提交项目之前获取下一个提交ID吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆