This is a sample file created to practice resolving merge conflicts.
- Clone this repository
- Create a new branch -conflict
- On your branch, edit the "sample content lines below. The filename must be the same filename that your partner uses. Make sure the content inside the file is different, and that neither file is empty.
- Create a pull request in the class repository with base: main and compare: USERNAME-conflict
- You will see that the first pull request can merge well.
- When you see the merge conflict in the second pull request, work together to resolve the merge conflict.
- Working locally, merge main into your branch.
- When you see there's a conflict, that's OK! The files that have conflicts are listed under Unmerged Paths. Type git status to verify which file has the conflict.
- Open the file in your text editor, and look for the merge conflict markers. (<<<<<<<, =======, >>>>>>>)
- Both branches' versions of code are present - pick which one you want to keep, and save the changes.
- Add and commit the saved changes to resolve the merge conflict.
- Push your branch up to the remote, and see the resolution in the pull request.
- Merge the pull request.
-
In this repository, confirm the branch you are in is main.
-
Create a branch and name it as -modify-first.
-
In the -modify-first branch, edit the "Sample Content" below and commit it.
-
Change the branch to main again, create a second branch and name it as -modify-conflict.
-
In the -modify-conflict branch, edit the "Sample Content" below with different text and commit it.
-
Make sure the content inside of the file is different, and that neither file is empty.
-
Create a pull request in the class repository with base: main and compare: -modify-first. (title: USERNAME merge first)
-
Create a pull request in the class repository with base: main and compare: -modify-conflict. (title: USERNAME resolve conflict)
-
You will see that the first pull request titled USERNAME merge first can merge well.
-
Go through steps mentioned above to resolve the merge conflict.
Hello, today is . This is line 2, by . I live in , . Hello, today is 1/9/2025. This is line 2, by David Torres. I live in Bogota, Colombia. Hi! Daniela Carrillo Díaz is editing.