I have a clone of a repo on Github in which I created a new feature for upstream. The problem is, I did that in my master branch which also contains other stuff I pulled in from other clones. That totally broke my ability to create a reasonable pull request.
So I want to do the following:
- Restore my master branch to be exactly the same as upstream master.
- Create a new branch.
- Move some of my old commits to the new branch.
- Create a pull request off the branch.
And, in the future, I will do all my work in branches and create pull requests off them while leaving my master branch alone and just merging down whatever comes in from upstream.
My questions are:
- Is this a reasonable approach?
- How would I actually do steps 1 and 3?
Make a new branch to hold stuff
Send to remote for backup (just incase)
Reset local master to the commit before you started modifying stuff
Merge in changes from upstream master
Now DELETE master on remote repo
On github this won’t work without first going into the admin section for the fork and setting the default branch to something other than master temporarily as they try and protect you from blowing stuff away.
And recreate it
On github you should now set the default branch back to master