Describing my Merge Conflict Resolution

I couldn’t see a thread for describing the Merge Conflict Resolutions from Lecture 20, so I started this one.

  • Following along with Ben’s lectures (and learning the tiniest bit of Unity 3D into the bargain) I was messing about with a ground plane, a red box and a couple of materials when along came a snowman, albeit it with no arms.

  • I considered it prudent to branch my project at this point as I wasn’t sure that the snowman was really the direction to go in, sunny day, green grass and all.

  • As you can see, I added some a body, a head and the ubiquitous black hat to the snowman, dutifully saving in Unity and making commits as I went along.

  • It was at this time, unbeknown to me, that it all started to go wrong. In retrospect, it was, of course, all Ben’s fault. He was making this shiny red sports car out of a cube and some cylinders and I thought “Maaaan, I want one of those”. The next thing I knew, I was back in the master branch, knocking out my own red sports car, saving the project as I tweaked it, and making commits without a care in the world.

  • Pleased with the car, I merged that into the Master, made another couple of mods and committed them.

  • Somewhere along the way I realised that I did want the snowman after all. But wait… he’s in a branch in a scene called “SampleScene” and the car is in the master in a scene also called “SampleScene”. < sigh > If I go ahead and merge the branch, it’s not going to end well for one of them.

Here is what I did:

  • When the Merge dialogue came up with the conflict error: stashed the uncommitted changes it showed. (This was necessary before switching branches.)

  • Checked out the snowman branch and opened it in Unity. Duplicated the scene, named it snowman, saved it and committed.

  • Checked out the the master branch. Right clicked the snowman branch and chose the option to merge it into the current branch.

  • Read, absorbed and dismissed the error messages.

  • Clicked on the uncommitted changes at the top of the History.

  • In the Staged Files pane: right clicked on the file name with the orange warning trianlge and chose “Resolve Conflicts -> Resolve Using Mine” from the menu and clicked OK on the confirmation dialogue.

  • Committed the changes.

  • Back in Unity I now have “SampleScene” with my shiny red sports car AND “Snowman” with my bowler hatted, but armless snowman.

  • Finally, I removed the PT-snowman branch altogether.

The moral of this story? Don’t be distracted by the shiny. Red sports cars are often trouble*.

I’m not sure this will really be much help to anyone else, it’s little more than a description of me working through the lecture. But, it was very useful for me. I did it the first time following along with Ben and it seemed oh so easy. When I tried to recreate it on my own, making notes as I went, it took me four goes to get it right. So if nothing else, this will be printed and pasted into my logbook as a reference for me, for next time :c)

*The last one I had was a LOT of trouble.

3 Likes

My merge conflict resolution was simulating a situation where two people were assigned to prototype different colors for the car:

  1. Two Branches were created: bluecar and redcar
  2. Bluecar was merged into master before a real decision was made about the car color.
  3. The boss wanted the car red, so I then tried to merge the redcar, and now we have a merge conflict.
  4. I chose to keep “theirs” which is the redcar and successfully resolved the merge conflict.

2 Likes

Describing my Merge Conflict Resolution

  • I created an initial project that contains only ground 3D objects.
  • I added some materials and created a car model using 3D objects.
  • From this point 3 branches were created: pt-Tree , pt-Building, and pt-Snowman .
    • The branches were simulating a situation of 3 different people working on the same scene.
    • Each team member worked on a different model for the scene.
    • In the simulation, I simulated I was the team member who worked on the tree model.
  • After the tree model was completed the team decided to include this model in the scene. So, I merge it into the master. Each team member continued to work.
  • The team member that worked on the pt-Snowman branch finished it and the team decided to include it too. He marge the pt-Snowman to master but then we had marge conflict.
  • The Steps that were taken to resolve this conflict:
    • Stashed the uncommitted changes to switching branches.
    • Change to the snowman branch.
    • Separated the snowman into his own scene by duplicate his scene.
    • Select the master branch and after this branch selected click on the pt-Snowman branch and chose the option to merge this branch into the current branch (in our case master branch).
    • Solved the conflict by using “resolve using Mine” from the confirmation dialogue.
  • The first conflict was successfully handled.
  • The team wants to move the snowman into the main scene, so the model of the snowman was copied into the main scene from his scene and after that deleting the snowman scene. From this point, the snowman model is in the main scene too.
  • The second conflict was solved in the same way except for one thing: the “resolve using there” was chosen in this case.

Privacy & Terms