Alex Rivera | Logout

How do I clean up my Github fork so I can make clean pull requests?

Asked 2011-05-23T19:57:33.267
85

I forked a repository on Github. I've made some minor changes and submitted pull requests to the upstream, but along the way my fork has become so mangled I'm unable to generate clean pull requests; when I start a pull request from a branch with six changes, Github wants to submit thirteen, with seven of them already existing upstream (natch).

My problem seems to be related to only pulling the latest commits, but when I create a new branch and cherry-pick commits I still have extras. I've futzed with rebasing as well, but now it looks like even my master is so messed up I can't generate a clean copy of upstream. This is apparently because I didn't understand that I needed to rebase instead of merging, so clearly I've made mistakes; what I'm trying to do is figure out how to unsnarl that knot and get back to a clean state where I can move forward usefully.

I kind of want to blow away my fork and make a new fork of the upstream, but I gather that, too, is difficult.

Having confessed my Git sins, how do I obtain github absolution?

Edit
Report

1 Answer

0

On your private repo, add the forkee's repo as a remote. Rebase/reset your branches from the remote's branches. Do a force push to your github repo.

If you need exact commands, let me know. Also let me know whether you want to try and preserve local commits or if "blowing away" is OK.

answered 2011-05-23T20:04:31.413

Your Answer