Skip to Main Content
TWIL
git
Illustration of Marisa demonstrating the process of Checking Out Pull Requests from Forked Remotes in Git, symbolizing the swift integration of important updates into a project's workflow.

Welcome to another installment of TWIL, the weekly knowledge boost from Cuttlesoft where we showcase the practical insights our team members discover. In this week’s edition, Marisa offers a clear guide on how to Checkout Pull Requests from Forked Remotes in Git. Learn the step-by-step process to incorporate changes swiftly, even before they're merged upstream—perfect for times when updates can't wait.

Checkout pull request from forked remote

Say you have a library you are using, and there's an issue with it. A fix has been pull-requested, but it hasn't been merged in. We should:

  1. Fork the library
  2. Set the upstream
  3. Checkout the PR locally
  4. Push up our branch
  5. Set the source for the library as our forked branch

Fork the library for Cuttlesoft

git clone <cuttlesoft-library-url>
git remote add upstream <library-url>
git fetch upstream pull/<PR-ID>/head:<new-branch-name>
git checkout <new-branch-name>
git push origin <new-branch-name>

Get the url for the commit pushed up to our Cuttlesoft fork, it should look like:

https://github.com/cuttlesoft/<library-name>#<commit-hash>

Update your package.json with the url like so:

"<library-name>": "https://github.com/cuttlesoft/<library-name>#<commit-hash>",

Make sure you yarn install or npm i and you should be good to go!

  • Git
Marisa Gomez's profile picture
Marisa Gomez

Senior Software Engineer

Related Posts

Digital pioneer journeying through technological quirks, reminiscent of vast waterfalls and rocky terrains
April 5, 2017 • Kyle Misencik

Infinitely dispatching actions + React, Redux & React Router v4

While implementing JWT for an application, we ran into a quirk with React Router v4. Here, we hope to show how to implement protected client-side routes while avoiding some of the pitfalls we encountered.

Turtle swimming close to a life preserver as a metaphor for developers using Git version management to stay afloat
May 4, 2017 • Nick Farrell

Life-Saving Git Tips

From salvaging lost commits to streamlining your workflow, discover how to make your coding life smoother and avoid common pitfalls.