How do I work with branch merge conflict management?

Asked

Viewed 360 times

2

I did a quick study on git-flow, but I didn’t identify how it works on the merge conflict issue. In an article I read, the author mentioned each contributor pulling the repository, managing conflicts and only then uploading their code.

How to proceed in this case?

  • This is a good question. My idea is that the problem (conflict) should be "distributed" to each developer. What usually happens is that each developer regularly updates their branch, merging with the branch they want to merge. If I am working on task A, whose branch is also called A, and when I finish it I intend to merge with branch B (other people will also merge to B), I regularly merge A with B and resolve the conflicts that appear. And when it’s actually up A to B, the chance of conflict is very low.

  • In particular, I’ve never read anything about git-flow’s explicit preoccupation with merge conflicts. My practice says that this is eventual (not the most common thing in the world) and that it is largely solved at the level of pull/merge-request. Also I did not have a good experience with the resolution distributed among the members of the team: each one resolved anyway to continue its task, so as to harm the work of others

1 answer

1

After your commit you will push and create the merge request (join your branch with master), if there is a conflict:

Group that has a head of architecture (or someone who manages the project) this person will be responsible for resolving the conflicts.

Group with independent developers, after merge request and exists conflict, each developer needs to resolve conflicts individually.

Example:

First pull back on the last master version and then go back to your branch.

git merge origin Master

rectify the conflicts...

 <<<<<<< HEAD
public void exemplo() {
}
=======
public void exemplo(string teste) { ...
}
>>>>>>> origin/<remotebranch>

you need to remove what will not be used.

This part comes from Master:

<<<<<<< HEAD
 public void exemplo() {
 }
 =======

and that part comes from your branch

=======
public void exemplo(string teste) { ...
}
>>>>>>> origin/<remotebranch>

after editing, commit and push again.

  • For these corrections, you can use the mergetool

  • i prefer to fix via ide, have but control over what will be merged. (Visual Studio) @Valdeirpsr

Browser other questions tagged

You are not signed in. Login or sign up in order to post.