git Github 提交语法以链接拉取请求/问题

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/23019608/
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-10 18:00:01  来源:igfitidea点击:

Github Commit Syntax to Link a Pull Request/ Issue

gitgithubcommitgithub-flavored-markdown

提问by AlbertEngelB

I've seen commit messages that refer to a specific issue / pull request. What is the syntax to include a specific repository's issue or pull request?

我已经看到了涉及特定问题/拉取请求的提交消息。包含特定存储库的问题或拉取请求的语法是什么?

回答by nulltoken

Use the documentedauto-linking format for issues across repositories.

对跨存储库的问题使用记录的自动链接格式。

  • Syntax:{owner}/{repository}#{issue_number}
  • Example:mojombo/jekyll#1
  • 句法:{owner}/{repository}#{issue_number}
  • 例子:mojombo/jekyll#1

When such formatted text is present in a commit message, it's automatically transformed into a clickable link which will redirect one to https://github.com/{owner}/{repository}/issues/{issue_number}

当提交消息中出现此类格式化文本时,它会自动转换为可点击的链接,该链接会将一个链接重定向到 https://github.com/{owner}/{repository}/issues/{issue_number}

回答by geg

Use #1234in a comment to reference pull request 1234 from the current repo.

#1234在评论中使用以引用当前存储库中的拉取请求 1234。

回答by zw963

Github share PR/Issue number use the same sequence.

Github 分享 PR/Issue number 使用相同的顺序。

So, one #number either one PR or one Issue.

所以,一个 #number 要么是一个 PR 要么是一个问题。

Just use #number is OK.

只需使用#number 就可以了。

回答by Matt G

For linking to another repository, if you just paste the link to the issue or pull request, say https://github.com/{owner}/{repository}/issues/{issue_number}, GitHub will render it as

对于链接到另一个存储库,如果您只是将链接粘贴到问题或拉取请求,例如https://github.com/{owner}/{repository}/issues/{issue_number}GitHub 会将其呈现为

[{owner}/{repository}#{issue_number}](https://github.com/{owner}/{repository}/issues/{issue_number})

For example, https://github.com/jlord/sheetsee.js/issues/26will render as jlord/sheetsee.js#26.

例如,https://github.com/jlord/sheetsee.js/issues/26将呈现为jlord/sheetsee.js#26

See https://help.github.com/articles/autolinked-references-and-urls/#issues-and-pull-requests

请参阅https://help.github.com/articles/autolinked-references-and-urls/#issues-and-pull-requests