class: center, middle, inverse, title-slide # Lab 03 ## Merge Conflicts & SLR Inference ### 09.12.19 --- class: center, middle # Welcome to lab --- ## Agenda 1. What are merge conflicts? 2. Practice dealing with merge conflicts 3. Lab introduction 4. Starting a new project & lab tips --- class: middle, center ## Merge Conflicts --- ### What are merge conflicts? When two collaborators make changes to a file and push the file to their repo, git merges these two files. <img src="img/03/merge-no-conflict.png" width="300" style="display: block; margin: auto;" /> If these two files have conflicting content on the same line, git will produce a <font class="vocab">merge conflict</font>. <img src="img/03/merge-conflict.png" width="300" style="display: block; margin: auto;" /> --- ## Resolving merge conflicts - Merge conflicts need to be resolved manually, as they require a human intervention <img src="img/03/merge-conflict-identifiers.png" width="800" style="display: block; margin: auto;" /> - To resolve the merge conflict - decide if you want to keep only your text or the text on GitHub or incorporate changes from both texts - delete the conflict markers `<<<<<<<`, `=======`, `>>>>>>>` and make the changes you want in the final merge --- ### Practce dealing with merge conflicts - **Everyone**: Clone the repo starting with **merge-** in RStudio Cloud (`merge-conflicts-TEAMNAME`), and open the R Markdown file. Remember to configure git! - Assign the numbers 1, 2, 3, and 4 to each of the team members. - If you have 3 team members, just assign numbers 1 -3. - Follow the [application exercise instructions](https://www2.stat.duke.edu/courses/Fall19/sta210.001/labs/lab-03-merge-conflicts.html) **<i>exactly</i>**. - Raise your hand if you have any questions during the exercise. - Completing the exercise will be part of the Lab 03 grade. - Once you've completed the merge conflict exercise, read the rest of the slides and start working on Lab 03. Use the repo with the prefix **lab-03-slr-inf-** to complete the lab. --- ### Tips for collaborating via GitHub - Always pull first before you start working. - Knit, commit, and push often to minimize merge conflicts and/or to make merge conflicts easier to resolve. - If you find yourself in a situation that is difficult to resolve, ask questions asap, don't let it linger and get bigger. --- ## Lab Introduction - In today's lab, you will be analyzing data from the food menu at Starbucks. - The focus of the lab is to give you practice conducting statistical inference for simple linear regression. - You will also get a chance to explore new data visualizations and functions to summarise data. --- ## Starting a new project - Go to the course GitHub organization and find the **lab-03-slr-inf** repo that has your team name on it. - On GitHub, click on the green Clone or download button, select Use HTTPS (this might already be selected by default, and if it is, you’ll see the text Clone with HTTPS). Click on the clipboard icon to copy the repo URL. - Go to RStudio Cloud and into the course workspace. Create a New Project from Git Repo. You will need to click on the down arrow next to the New Project button to see this option. - Copy and paste the URL of your assignment repo into the dialog box and click OK. --- ## Configure Git - Type the following lines of code in the console in RStudio filling in your name and email address. ```r library(usethis) use_git_config(user.name="GITHUB USERNAME", user.email="your email") ``` - Update the name of your RStudio project to "Lab 03" --- ## Tips for Lab - Each group member should commit and push to GitHub at least once - It is good practice to name your R code chunks. Do not put spaces in the code chunk names. - Check the .md file on GitHub to make sure it has all of your work, including output and graphs.