class: center, middle, inverse, title-slide .title[ # Merge conflicts ] .subtitle[ ## Math 118 ] .author[ ### ] --- ## Housekeeping - HW 07 assigned today, due next Tuesday 11/15 at 11:59pm --- ## Agenda 1. What are merge conflicts? 2. Practice dealing with merge conflicts 3. Project proposal details 5=4. Work! --- class: middle, center ## Merge Conflicts --- ## Pulling - Thus far, we have only *pushed* our local changes back to GitHub - However, if two or more people are working on the same project, you need some way to obtain the changes that others have made and update your version accordingly - We do this by **pulling** changes from GitHub --- ### 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/merge-conflicts/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/merge-conflicts/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/merge-conflicts/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 --- class: center, middle ## Merge conflict activity .question[Create a team name!] --- ### Practice dealing with merge conflicts - Clone the repo starting with **final-project-** that has your new team name. Open the `project-proposal.Rmd` R Markdown file. - Assign the numbers 1 and 2 to each of the team members. - If you have 3 team members, assign numbers 1 - 3. - Follow along as we complete each step of the exercise instructions. - Raise your hand if you have any questions during the exercise. --- <img src="img/merge-conflicts/1-push-error.png" width="800" style="display: block; margin: auto;" /> --- <img src="img/merge-conflicts/2-merge-conflict-message.png" width="800" style="display: block; margin: auto;" /> --- <img src="img/merge-conflicts/3-merge-conflict-rmd.png" width="800" style="display: block; margin: auto;" /> --- <img src="img/merge-conflicts/4-fixed-rmd.png" width="800" style="display: block; margin: auto;" /> --- <img src="img/merge-conflicts/5-resolved-message.png" width="800" style="display: block; margin: auto;" /> --- <img src="img/merge-conflicts/6-push-ready.png" width="800" style="display: block; margin: auto;" /> --- <img src="img/merge-conflicts/1-push-error.png" width="800" style="display: block; margin: auto;" /> --- ## 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. - Communicate with your partner when you are working on a given file - If you find yourself in a situation that is difficult to resolve, ask questions ASAP, don't let it linger and get bigger. --- class: middle, center # Project proposal details --- ## Requirements - Pick a dataset and come up with at least two research questions, motivated by some EDA - Upload the selected dataset to your GitHub repository - Must be completed in the `project-proposal.Rmd` file - The R markdown file has guidance in the structure of the project proposal - Submit PDF of project proposal to Canvas by Friday, 11/18 at 11:59pm