Lesser known features of GitHub and that you could be using today! image Checkout this image from Cameron McEfee on Octodex.

Saved replies

saved-replies-ui

Here's what they do:

Saved replies allow you to create a reusable response to issues and pull requests. Save time by creating a saved reply for the responses you use most frequently.

Once you've added a saved reply, it can be used in issues, pull requests, and discussions. Saved replies are tied to your personal account. Once they're created, you'll be able to use them across repositories and organizations.

Source: GitHub docs

I have some that I use to help make my pull request or issue descriptions more clear so that reviewers will have more up-front context about the change they are reviewing.

Here are my top ones:

1. Before/After HTML table template

before-after.md
Copy
<table>
  <thead>
    <tr>
      <th>Before</th>
      <th>After</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td>
        <pre lang="typescript">
          // before code
        </pre>
        <img src="before-image.jpg" alt="Before the change" />
      </td>
      <td>
        <pre lang="typescript">
          // after code
        </pre>
        <img src="after-image.jpg" alt="After the change" />
      </td>
    </tr>
  </tbody>
</table>

Here's an example of what it looks like:

before/after screenshot

2. Collapse

A convenient way to include long content such as log output or images without forcing a reader to scroll a bunch if they don't want to immediately view it.

collapse.md
Copy
<details>
  <summary>Open me by clicking</summary>

  Some long text Some long text Some long text Some long text Some long text Some long text Some long text Some long text
</details>

Here's an example of what it looks like:

collapse closed
Collapsed
collapse open
Expanded

Allows for pointing some specific piece of code even if the code on the lines change in the future.

  1. View a file in GitHub, in a browser
  2. Press the y key to update the URL to a permalink URL
  3. Copy the link and share it
  4. Bonus if you share a link to a link of code somewhere else in GitHub, such as a comment, or pull request description, you'll get a part or even all of the code displayed within the comment. Ex.
permalink url
A permalink URL
permalink url rendered
Permalink rendered in GitHub content

GitHub docs: https://docs.github.com/en/repositories/working-with-files/using-files/getting-permanent-links-to-files