Answer the question
In order to leave comments, you need to log in
How to resolve conflicts in two branches when merging through a Pull Request?
Situation: there is a master branch, there is a dev branch, to which changes are added by pull request. You can't push directly.
Each programmer creates his own new branch from the develop branch. Let the programmer branch be called feature.
Having solved the problem, the programmer pushes it to origin/feature and creates a pull request from origin/feature to origin/dev. When opening a PR, there may be conflicts between the dev and feature branches.
To avoid such conflicts. Before submitting to origin/feature, the programmer merged dev into feature and resolves conflicts. Then it pushes to origin/feature and creates a PR origin/feature -> origin/dev.
When PR from orgin/dev to origin/master, conflicts arise that were resolved earlier (with PR feature->dev)
How can such conflicts be resolved? You can't merge into dev master and push to origin/dev and repeat PR.
Answer the question
In order to leave comments, you need to log in
It's strange that some unfinished feature hasn't arrived in master yet... ;)
Let's answer the question: What do you need dev for? Not really for development, as you might think, but for feature testing. Correctly?
In this regard, your problem is solved by the following steps:
1. Rename dev to stage (test, etc.) and forget that development is underway there.
2. All feature branches must be created from master.
3. After the feature is completed, it is merged into the stage and checked. It is possible even without PR, because now no trash can fundamentally get into master.
4. If everything is in order, make a PR from the feature branch to master.
5. stage can sometimes just be demolished and recreated from the master's head to make the story more beautiful. ;)
PS: It's kind of mania for teams to have a dev branch... "We're doing development - we should have a dev branch!". So what?
Not every project needs a dev branch! More precisely, if you have a dev branch, then you must also have a release branch and you must update the application with large releases with some preparation for them.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question