问题
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]
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?
回答1:
A git commit id is a SHA-1 hash of:
- The commit message
- Author and committer info
- The date
- The contents (the hash of the tree)
- The parent commit hash (or hashes, for merges)
So, the commit id can only be produced after the item has been committed.
来源:https://stackoverflow.com/questions/45850890/can-you-get-the-next-commit-id-before-items-are-commited