Lab 02 - Merge conflicts and collaboration on github

Learning goals

Before Lab: Read about merge conflicts below. The merge conflict exercise we’ll start with during the lab will assume that you have this background information.

Merges and merge conflicts

This week, we’re going to do our lab in teams, so we’re going to make things a little more interesting and let all of you make changes and push those changes to your team repository. Sometimes things will go swimmingly, and sometimes you’ll run into merge conflicts. So our first task today is to walk you through a merge conflict!

Git will put conflict markers in your code that look like:
<<<<<<< HEAD 

See also: [dplyr documentation](https://dplyr.tidyverse.org/)

======= 

See also [ggplot2 documentation](https://ggplot2.tidyverse.org/)

>>>>>>> some1alpha2numeric3string4

The ===s separate your changes (top) from their changes (bottom).

Note that on top you see the word HEAD, which indicates that these are your changes. Memonic: It’s YOUR HEAD, and they both have four letters.

And at the bottom you see some1alpha2numeric3string4 (well, it probably looks more like 28e7b2ceb39972085a0860892062810fb812a08f).

This is the hash (a unique identifier) of the commit your collaborator made with the conflicting change.

Your job is to reconcile the changes: edit the file so that it incorporates the best of both versions and delete the <<<, ===, and >>> lines. Then you can stage and commit the result.

Merge conflict activity

Setup

Let’s cause a merge conflict!

Our goal is to see two different types of merges: first we’ll see a type of merge that git can’t figure out on its own how to do on its own (a merge conflict) and requires human intervention, then another type of where that git can figure out how to do without human intervention.

Doing this will require some tight choreography, so pay attention!

Take turns in completing the exercise, only one member at a time. Others should just watch, not doing anything on their own projects (this includes not even pulling changes!) until they are instructed to. I recommend putting your hands in your pockets or sitting on them when it’s not your turn!

Before starting: everyone should have the repo cloned and know which role number(s) they are.

Role 1:

🛑 Make sure the previous role has finished before moving on to the next step.

Role 2:

🛑 Make sure the previous role has finished before moving on to the next step.

Role 3:

🛑 Make sure the previous role has finished before moving on to the next step.

Role 4 (pick anyone except the Role 3 participant)

🛑 Make sure the previous role has finished before moving on to the next step.

Everyone: Pull, and observe the changes in your document.

Discuss the following in your group:

  1. does anyone need to push anything at this point for the exercise to be completed as far as your instructors or TAs are concerned?
  2. Does anyone need to pull anything at this point for their local version of the repository to be complete? If so, go ahead and do this.

Tips for collaborating via GitHub

Rubric (15 points possible)

4 points if questions 1 and 2 have answers added as text. 5 points for >= five commits with informative messages made to the repo. 6 points for commits being from alternating team members following the directions above to create and resolve merge conflicts.