I have a master branch and a feature branch. the feature branch gets merged into the master branch with updated code every day or so. However, it does happen often that changes get merged directly into the master branch without going through the feature branch first.
This means that the master branch needs to be merged into the feature branch too. So the master branch contains some updated code and some outdated code and the feature branch contains some updated code and some outdated code.
When trying to merge the master branch into the feature branch sometimes there are cases where the master branch wants to revert changes made on the feature branch, even though the feature branch has the most up to date code.
How can this be prevented?
This means that the master branch needs to be merged into the feature branch too
That is not a best practice:
feature
to master
) where the merge conflicts are more limited (unless, in your case, you have concurrent evolution to master
from from other change branches)master
to feature
), where merge conflicts are almost assured, because of concurrent changes coming from both master
and other branches, both merging to feature
.Ideally, you just delete feature
, and recreate it on top of master
, where you merge again the changes that need to be integrated together.
The integration branch becomes a transient branch, which means it should not even been merge to master at all:
feature
, to test them togethermaster
, because they are ready to be part of the next releasefeature
, and recreate it.That is the idea behind gitworkflow
(one word).