How to bring a pull request to a state of “can be merged automatically”?
I have branched from
dev branch into
feature branch and made some commits. Now, when i send a pull request to merge a
feature branch into
dev branch I notice on github that the branch cannot be merged automatically because of some conflicting changes. What do i need to do in order to bring my
feature branch into the state of “can be merged automatically”?
What i currently do is:
- Checkout the
- Remember the lines that caused the conflict
- Checkout the
- Manually revert each line to the state of the
- Commit and push the patch
But this looks like many handwork. So i wondered if this can be simplified somehow?
Mind that i would like to keep my
feature branch changes isolated from
develop branch (for the purpose of keeping track of which branch introduced regressions and testing each new feature in isolation to other features). So, while merging/rebasing
feature would solve the problem, it would bring all the changes made in
feature and i would loose isolation.
One Solution collect form web for “How to bring a pull request to a state of “can be merged automatically”?”
Few assumptions: you took a branch out from
dev and called it
feature and you want to merge
feature is not mergeable to
dev branch because someone has already made changes todev` which cannot be conflict resolved by git automatically.
In this scenario, there are two approaches that you can take
- Rebase – In this case you will follow these steps below
- take pull from remote
git rebase dev– Internally, this 1) removes all your commits beyond last
devwere same 2) applies all
commits 3) one by one apply all
featurecommits – and as an when
conflicts occur, git prompts you to fix the conflicts. The last step
repeats until all your commits have been successfully applied back to
- Push all changes to
- Send in a pull request 🙂
This is the one that I always follow and it is recommended that you keep taking pull from parent branch regularly to avoid conflicts. This creates a diamond structure in git commit history.
- The second one is merge, but I use and find rebase much cleaner and use that always.