I forked a template repository (T) on GitHub and did some work in my own repo (X) making use of the template.
Now repo X completely conflicts with repo T because of custom work I pushed to X.
Other than doing custom work with the template, I also did some improvements to the template.
I created a pull request but it contains all my past commits since forking. I want to include only template improvements (just a few commits in the middle of my commit history) in the pull request. How can I achieve this?
You have to separate the template changes (improvement commits, that you want to merge to the upstream repo with a pull-request) from your custom commits.
The better way is to use two different git repositories, but in case of you prefer to maintain only one you have to:
git checkout -b tempmaster
git checkout master # return to the previous one if master
git remote add upstream https://github.com/...
git fetch --all
git reset --hard upstream/master # if master
git cherry-pick
) from the temp branch and fix conflicts.git checkout -b myapp
and import yours custom commits in the same way.Once fixed, when you want to update your forked branch (master) with upstream changes, use rebase:
git rebase upstream/master
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With