Question

I have a project that I created and maintain for a larger project. When my project was ready to go, the larger project forked my repo and now they publish my work on their site. They made some changes to my work on their fork. I have since pulled those changes back into my repo.

Now, a few months down the road, I would like to submit a pull request to their fork to pull in some new changes I've made. The problem is that the specific change I made was a while back. I only want to create a pull request for this one specific change I made. Unfortunately I never created a branch just for this change. The change was made and committed to a large "development" branch. (Probably not best practice) Since then I've made 6 or 7 other changes and commits to this development branch.

How would I go about "cherry-picking" that one commit into a new branch and then submit that branch as a pull request to the fork in question on Github? I'm not really sure where to start the new branch since all my work is ahead of their fork.

Was it helpful?

Solution

  1. Add their fork as a remote: git remote add someNameForTheirFork https://github.com/theiruser/theirfork.git
  2. Checkout their latest: git checkout someNameForTheirFork/master (or whatever branch they've published)
  3. Checkout a new branch: git checkout -b someNewBranch
  4. Cherry-pick your commit: git cherry-pick COMMIT_HASH
  5. Verify the changes, push your new branch, and create a pull request from it.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top