So here's a typical workflow on Github…
-
Like some project
->
fork it->
git clone https://github.com/you/someproject
. -
Open project. Like what you see, but make some changes.
-
Having been careful to work only in a
feature-branch
(git checkout -b some-feature
), you decide to make a pull request with theupstream
maintainer – after having pushed yourfeature-branch
to your Github fork. -
Maintainer, for whatever reason, declines the pull.
For example.. here is a failed pull request that I submitted that matches the above scenario...
Now typically, if the maintainer HAD merged the pull… the workflow would be simple… On my local machine, I would commit any local changes on whatever feature-branch
I was on at the time… git fetch --all
, git checkout master
, git pull upstream --ff-only
. Then replay my changes on top of that, as desired…
BUT…
What if I decide that you want to continue working off the changes to my fork, regrdless… yet still want to be able to track + merge changes that happen upstream
? Ordinarily, I would delete the feature branch, and go on my way.. How can you maintain a master
branch that is able to be merged upstream, yet maintains your fork's features while being "permanently detached" from upstream
's HEAD
?
Best Answer
Regardless of the use of your scenario, here is how you can do it:
With this strategy it should work. But keep in mind that every change you make in a feature branch based upon custom won't be accepted into upstream master.