Github Commit Syntax to Link a Pull Request/ Issue

GitGithubCommitGithub Flavored-Markdown

Git Problem Overview


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?

Git Solutions


Solution 1 - Git

Use the documented auto-linking format for issues across repositories.

  • Syntax: {owner}/{repository}#{issue_number}
  • Example: 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}

Solution 2 - Git

Github share PR/Issue number use the same sequence.

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

Just use #number is OK.

Solution 3 - Git

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

Solution 4 - Git

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

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

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

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

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionAlbertEngelBView Question on Stackoverflow
Solution 1 - GitnulltokenView Answer on Stackoverflow
Solution 2 - Gitzw963View Answer on Stackoverflow
Solution 3 - GitgegView Answer on Stackoverflow
Solution 4 - GitMatt GView Answer on Stackoverflow