如何在 git commit 消息中引用先前的提交

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/13577311/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-19 07:49:01  来源:igfitidea点击:

How to refer to a previous commit in git commit message

gitgithub

提问by Joel

Is there a convention for referring to a previous commit in a git commit message?

在 git commit 消息中是否有引用先前提交的约定?

Example commit message:

示例提交消息:

Fixed bug such and such introduced in a1b2c3e4

In particular, is there a convention that github.com will understand, and convert to a link?

特别是,是否有 github.com 会理解并转换为链接的约定?

回答by Michael Shimmins

Yup - GitHub will pick up references to SHAs and users/repos patterns using the GitHub Flavored Markdown

是的 - GitHub 将使用GitHub Flavored Markdown 获取对 SHA 和用户/存储库模式的引用

Specifically about linking to commits:

特别是关于链接到提交:

A bit of the GitHub spice

In addition to the changes in the previous section, certain references are auto-linked:

  • SHA: be6a8cc1c1ecfe9489fb51e4869af15a13fc2cd2
  • User@SHA ref: mojombo@be6a8cc1c1ecfe9489fb51e4869af15a13fc2cd2
  • User/Project@SHA: mojombo/god@be6a8cc1c1ecfe9489fb51e4869af15a13fc2cd2
  • #Num: #1
  • User/#Num: mojombo#1
  • User/Project#Num: mojombo/god#1

一点 GitHub 香料

除了上一节中的更改之外,某些参考文献是自动链接的:

  • SHA:be6a8cc1c1ecfe9489fb51e4869af15a13fc2cd2
  • 用户@SHA 参考:mojombo@be6a8cc1c1ecfe9489fb51e4869af15a13fc2cd2
  • 用户/项目@SHA:mojombo/god@be6a8cc1c1ecfe9489fb51e4869af15a13fc2cd2
  • #编号:#1
  • 用户/#Num: mojombo#1
  • 用户/项目#Num:mojombo/god#1