Git: merging multiple branches

I apologize if this was answered somewhere in full, obviously and many times, as it probably already is; but I could not find information about this particular problem that I received after searching for at least a week.

To simplify, we have 3 people who are working on the project, each person has his own branch, which we are regularly going to merge back into the trunk trunk. The problem is that we either encounter conflicts (trying to choose a cherry pick), or simply rewrite all the wizard files and the first two branches combined with the last, without actually quarreling, just overwriting.

My problem (hopefully) is simple:

Trunk line

string test1; string test2; string test3; 

branch test1

  string test1 = "Dan Branch merged"; string test2; string test3; 

branch test2

 string test1; string test2 = "Dave Branch merged"; string test3; 

test3 branch

 string test1; string test2; string test3 = "Will Branch merged"; 

The desired output when combining all 3 branches:

 string test1 = "Dan Branch merged"; string test2 = "Dave Branch merged"; string test3 = "Will Branch merged"; 

What I actually get when I try to combine tests 1 and 2:

Auto merge error; fix conflicts and then record the result.

  <<<<<<< HEAD + String test1 = "Dan Branch merged"; + String test2; + String test3; ======= + String test1; + String test2 = "Dave Branch merged."; + String test3; >>>>>>> test2 

I am currently using git-gui on Windows (with a bash / shell / cli transition plan when I finally hugged git), so if possible, be great if any answers were given specifically for git-gui, but, of course, beggars cannot be choices.

Trying to keep things simple, the repository is on the local network, and not on any server. I do not know if this affects the implementation (I would suggest that push and pull would not be used if I guessed correctly about their use)

Currently, Git is referred to as a method of storing and viewing old versions, since all merges are done manually.

+4
source share
1 answer

How you process your code may not be the usual way to handle distributed development. I would recommend (if access to the main trunk is available during development), follow these steps to make this work:

 git stash (to put your changes away for the moment) git pull (to get the latest commits) git stash pop (to get back, what was stashed away in the first step) 

Then resolve the conflict that you have. This should not be as much as when combining an entire branch. Then:

 git commit git push 

Important: Avoid changing the branch and working with the wizard. Branches are often used for the parallel development of things that are not performed every day for development. For instance. when you start a new, major version of the software that changes most of the old code or api, so you can’t just click on the wizard because the commit will deactivate the entire package.

Edit:

Thank David comment: This does not harm the use of branches in git, but I had one or two cases where impractically processed branches led to confusion that an inexperienced user of git had a hard time understanding and solving, However, this processing error should not to be ordinary.

Edit:

As it turns out, you really only have one local repository. It seemed to me that you have a local network repository that you all click on. Therefore, if you do not change your infrastructure (I do not recommend this as an alternative. Http://bitbucket.org , and each with its own repository clone on his computer), then there is (I think) no other way when there are three branches. I highly recommend that you read the git tutorial like http://www.vogella.com/articles/Git/article.html to change your infrastructure. Good luck with it.

+1
source

All Articles