CodeBlanks Logo Icon CodeBlanks

Pull conflict

Learn to resolve a conflict that arises during pull.

Conflicts During Pull

If remote changes modify the same lines differently from your local changes, a merge conflict may occur during git pull. Git asks you to decide which content should remain.

<<<<<<< HEAD
Local content
=======
Remote content
>>>>>>> origin/main

These markers identify the conflicting section; after resolving it, edit and save the file.

Steps to Resolve a Conflict

Remove the conflict markers from the file and keep the final content you want. After saving the file, use git add to tell Git that the resolution is complete.

git add index.html
git status
git commit

If the merge is still in progress, you can complete it with a commit. Do not leave conflict markers in the file.

Practice Resolve the Conflict and Commit

After resolving the conflict, add index.html to the staging area and create a commit. Finally, print a completion message.

Starter code

terminal
print("Çatışma çözüldü")

Sample solution

terminal
git add index.html
git commit -m "Resolve merge conflict"
print("Birleştirme tamamlandı")

Expected output

Çatışma çözüldü
Birleştirme tamamlandı

Questions and answers

Review the lesson questions together with their answers. To test yourself, solve the lesson interactively.

1 What does Git expect you to do when a conflict occurs during pull?

  • Delete the remote repository
  • Automatically delete every commit
  • Reset Git configuration
  • Edit and resolve the conflicting content Correct answer

Explanation: Correct. You should inspect the conflicting section, decide which content to keep, and edit the file.

2 Mark the Conflict as Resolved

Question
git add ____
Answer
git add index.html

Explanation: After editing the file and resolving the conflict, you mark the resolution to Git with git add index.html.

3 Recognize Conflict Markers

Term Meaning
<<<<<<< HEAD Start of local changes
======= Separates the two contents
>>>>>>> origin/main End of remote changes
git add Stages the resolution

All lessons in Beginner