Skip to content
R for the Rest of Us Logo

Dealing with Common Problems: Merge Conflicts

This lesson is locked

Get access to all lessons in this course.

Transcript

Click on the transcript to go to that point in the video. Please note that transcripts are auto generated and may contain minor inaccuracies.

Your Turn

You should have a merge conflict in the README.md file because you edited it both in RStudio and on GitHub

  1. Open up the README.md file and find the conflict markers, conflict divider, and identify which parts of the code come from the changes you made in RStudio and which come from the changes you made on GitHub

  2. Edit the README.md file to resolve the merge conflict

  3. Commit (I usually use a message like “fix merge conflict”)

  4. Push your code to GitHub

Learn More

If you get a merge conflict and it makes you feel like you need a hug, Allison Horst has you covered.

Have any questions? Put them below and we will help you out!

You need to be signed-in to comment on this post. Login.

Jessica Brewer

Jessica Brewer

October 7, 2022

When I delete the code I don't want from the merge conflict in the R script box in R Studio and try to commit it, I am getting the following message, "error: Committing is not possible because you have unmerged files.". How do I address this?

David Keyes

David Keyes

October 7, 2022

It's likely you still have a merge conflict somewhere that you haven't yet dealt with. Take a look all the way to the bottom of your file and let me know if you see anything!

Dorothy Q Kellogg

Dorothy Q Kellogg

March 28, 2023

I got the same thing as Jessica. I tried reverting and am now told my branch is one commit ahead of the master/origin. I'm thinking I should just kill the RStudio project and start over.

Dorothy Q Kellogg

Dorothy Q Kellogg

March 28, 2023

Same thing again. It still has the yellow boxes to the left of the file. When I made the edit, I made it in RStudio and saved. I wonder if something is different in how GitHub is dealing with merge conflicts. Here is the error message.

error: Committing is not possible because you have unmerged files. hint: Fix them up in the work tree, and then use 'git add/rm ' hint: as appropriate to mark resolution and make a commit. fatal: Exiting because of an unresolved conflict. U README.md

Dorothy Q Kellogg

Dorothy Q Kellogg

March 28, 2023

Flaky. I tried clicking the staged button a couple times, then it finally made the box to the left blue, and I could commit.

David Keyes

David Keyes

March 29, 2023

Sounds like you figure it out, which is great! If you still need any help, just reply here.