This repository contains the source code for a Tampermonkey script that adds a "copy" button next to commit SHAs on GitHub pull request pages. The screenshot below shows an example of this functionality:
The motivation for this script is to make it easier for developers to copy commit SHAs from pull request pages on GitHub.
Without this script, copying SHAs from GitHub's pull request web pages can be a bit tricky. It requires clicking in the exact right location to highlight text. It also requires pasting the SHA as plain-text with CTRL+SHIFT+V
vs. CTRL+V
(otherwise it pastes the contents as a commit URL, which generally isn't the intended behavior). This script fixes both of those quirks and can be easily used in Chrome, Firefox, Safari, Edge, and Opera as described in the Usage section below.
Follow the steps below to use the script:
- Install Tampermonkey in your browser using one of the browser store links below:
- Perform any necessary browser-specific post-installation steps:
- Chrome - Enable developer mode for extensions - https://www.tampermonkey.net/faq.php#Q209
- Firefox - N/A
- Others - Untested
- Open up the raw file content of add-button.user.js in your browser (using these instructions from GitHub)
- Tampermonkey will automatically recognize that you've opened up a
*.user.js
script and prompt you to install it - Done! Navigate to a pull request page on GitHub now and you should see the "copy" button next to commit SHAs
- If you don't see it right away, try closing and reopening your browser
Since this repository is public, Tampermonkey will periodically check it for updates automatically.