ArkChar
ArkChar

Reputation: 333

How can I submit partial change of my forked repo as patch?

I forked a repo from GitHub and make a bunch of changes. Then I found one of my modification in one file can be a patch to an issue of the original repo, but the author don't want to merge my other modifications, so I don't want to send a pull request directly. And I think forking it again and just modify that file to make a patch and then send pull request seems not so elegant. Are there any "standard" way to do that?

Upvotes: 8

Views: 4198

Answers (2)

Alexei Sholik
Alexei Sholik

Reputation: 7469

Write down the SHA-1 hash of the desired commit. Switch back to the original project's master branch, create a new branch off of it and cherry-pick that one commit onto the new branch.

You can then push the new branch to GitHub and send a PR with its changes.

If you have modified multiple files within one commit, you'll have to rewrite the commit somehow.

Upvotes: 1

In my opinion, you should make a new branch with the same root, then use cherry-pick to add every commit you made except those who are not accepted by the author.

Then send a pull request on this branch.

Moreover, if you want to regroup all your modifications into one simple commit, you may use a squash rebase on a local branch before pushing it online.

Upvotes: 8

Related Questions