> ## Documentation Index
> Fetch the complete documentation index at: https://notes.kodekloud.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Linking Activity Within a Pull Request

> Guide to GitHub autolinking methods for referencing issues, pull requests, and commits, explaining formats, examples, and best practices for readable, clickable cross-references.

Cross-linking within a GitHub repository creates an automated trail of context, making it easy to track how issues, pull requests, and commits relate to one another. This guide summarizes the common reference formats GitHub recognizes so your discussions remain concise, clickable, and easy to navigate.

## Issue and pull request references

GitHub recognizes multiple ways to reference issues and pull requests. Each becomes a clickable link and is tracked by GitHub across conversations, timelines, and the network graph.

Common reference formats:

* Direct URL — paste the full issue/PR web address; the UI displays a shortened, clickable representation.
* Shorthand ID — type `#` followed by the issue/PR number (e.g., `#42`) for references within the same repository.
* Legacy/alternate — some tooling or older docs may use the `GH-` prefix (e.g., `GH-42`).
* Cross-repository — reference an item in another repository with `owner/repository#number` (e.g., `octocat/Hello-World#42`).

| Reference style      |                                   When to use | Example                                              |
| -------------------- | --------------------------------------------: | ---------------------------------------------------- |
| Shorthand ID         |               Most common for same-repo links | `#1347`                                              |
| Cross-repo reference |                   Linking across repositories | `octocat/Hello-World#1347`                           |
| Direct URL           | When copying from browser or external systems | `https://github.com/octocat/Hello-World/issues/1347` |
| Legacy format        |         Encountered in older tools or exports | `GH-1347`                                            |

<Frame>
  <img src="https://mintcdn.com/kodekloud-c4ac6d9a/a1yR8aLLdg_kMSwz/images/GitHub-Foundations-Certification/Pull-Requests/Linking-Activity-Within-a-Pull-Request/github-cross-linking-issues-pull-requests.jpg?fit=max&auto=format&n=a1yR8aLLdg_kMSwz&q=85&s=69d450f0e957fbcf1a4bb025a1ff6ec4" alt="The image is a table explaining different methods for cross-linking issues and pull requests on GitHub, including direct URLs, standard IDs, legacy formats, and cross-repository links, along with when to use each method." width="1920" height="1080" data-path="images/GitHub-Foundations-Certification/Pull-Requests/Linking-Activity-Within-a-Pull-Request/github-cross-linking-issues-pull-requests.jpg" />
</Frame>

Examples

```text theme={null}
# Same-repo shorthand
#1347

# Cross-repo reference
octocat/Hello-World#1347

# Direct URL (the UI will shorten this)
https://github.com/octocat/Hello-World/issues/1347

# Legacy format
GH-1347
```

Regardless of the syntax you choose, GitHub will convert recognized references into links and maintain back-references on the referenced issue/PR timeline.

## Commit references

GitHub also auto-detects and links commit identifiers in comments, descriptions, and PR bodies. Use the format that best balances readability and precision for your workflow.

Common commit reference types:

* Commit URL — paste the full commit web address; GitHub displays a shortened seven-character SHA.
* Full SHA — include the full 40-character commit SHA when you need an exact identifier.
* Short SHA — the seven-character SHA shown in GitHub is usually sufficient for human-readable references.
* Username + SHA — `username@SHA` to indicate a specific user's commit (e.g., `octocat@7fd1a60`).
* Cross-repo commit — reference a commit in another repo with `owner/repository@SHA` (e.g., `octocat/Hello-World@7fd1a60`).

| Reference style   |                                Use case | Example                                                                                  |
| ----------------- | --------------------------------------: | ---------------------------------------------------------------------------------------- |
| Direct commit URL |       Copying directly from the browser | `https://github.com/octocat/Hello-World/commit/7fd1a604d4f2b3d2f3c9a9f1b6c2e5a6f7d8c9b0` |
| Full SHA          |            Exact, unambiguous reference | `7fd1a604d4f2b3d2f3c9a9f1b6c2e5a6f7d8c9b0`                                               |
| Short SHA         |     Readable, commonly used in comments | `7fd1a60`                                                                                |
| Username + SHA    |                Clarifies author context | `octocat@7fd1a60`                                                                        |
| Cross-repo commit | Reference commits in other repositories | `octocat/Hello-World@7fd1a60`                                                            |

<Frame>
  <img src="https://mintcdn.com/kodekloud-c4ac6d9a/a1yR8aLLdg_kMSwz/images/GitHub-Foundations-Certification/Pull-Requests/Linking-Activity-Within-a-Pull-Request/github-autolinking-commit-references-table.jpg?fit=max&auto=format&n=a1yR8aLLdg_kMSwz&q=85&s=9a3f4b6662eb7abf73eac6d7b0fcaeaf" alt="The image is a table explaining GitHub autolinking for referencing specific commits, detailing different reference types, how to write them, their display format, and when to use each." width="1920" height="1080" data-path="images/GitHub-Foundations-Certification/Pull-Requests/Linking-Activity-Within-a-Pull-Request/github-autolinking-commit-references-table.jpg" />
</Frame>

Examples

```text theme={null}
# Direct commit URL (UI shortens this)
https://github.com/octocat/Hello-World/commit/7fd1a604d4f2b3d2f3c9a9f1b6c2e5a6f7d8c9b0

# Full SHA (40 chars)
7fd1a604d4f2b3d2f3c9a9f1b6c2e5a6f7d8c9b0

# Shortened (displayed by GitHub as 7 chars)
7fd1a60

# Username + SHA (contextual reference)
octocat@7fd1a60

# Cross-repo commit
octocat/Hello-World@7fd1a60
```

<Callout icon="lightbulb" color="#1CB2FE">
  Best practice: use `#number` for references within the same repository and `owner/repo#number` for cross-repo links. For commits, prefer the 7-character SHA shown in the UI for readability; use the full SHA when you need an exact, unambiguous identifier.
</Callout>

These autolinking conventions keep conversations tidy, make references clickable, and ensure context is preserved across issues, PRs, and commits. For more details, see GitHub's documentation on linking references and commit SHAs:

* [About referencing issues and pull requests](https://docs.github.com/en/issues/tracking-your-work-with-issues/linking-a-pull-request-to-an-issue)
* [Viewing commits on GitHub](https://docs.github.com/en/repositories/committing-changes-to-your-project/viewing-contributions-and-commits)

<CardGroup>
  <Card title="Watch Video" icon="video" cta="Learn more" href="https://learn.kodekloud.com/user/courses/github-foundation-certification/module/d1fa4e43-2a65-4de9-8da8-dc9ea7cede8e/lesson/17aecaf3-3e8f-4bec-8097-d8c0eb4f9c93" />

  <Card title="Practice Lab" icon="flask-conical" cta="Learn more" href="https://learn.kodekloud.com/user/courses/github-foundation-certification/module/d1fa4e43-2a65-4de9-8da8-dc9ea7cede8e/lesson/458ae912-79af-4d74-b3c3-1c303bb0de3e" />
</CardGroup>
