CodeBlanks Logo Icon CodeBlanks

Summary - Conflict resolution

Combine conflict steps to resolve a merge conflict.

Conflict Resolution Workflow

If a conflict occurs during a merge, first inspect the markers in the file. Compare the current branch's content with the incoming branch's content, then edit the appropriate result manually or use a visual tool.

Inspect conflict
      |
      v
Resolve content
      |
      v
Stage file

After resolving the conflict, stage the file with git add to tell Git that the conflict has been resolved.

Practice Arrange Conflict Resolution Commands

Store the commands for visually inspecting a conflict and staging the resolved file in a JavaScript array, in order. The first command must be git mergetool and the second must be git add app.js. Print each command on a separate line using forEach.

Starter code

terminal
const commands = [
    // Görsel araç ve sahneleme komutlarını ekle
];

// Komutları sırayla yazdır

Sample solution

terminal
const commands = [
    "git mergetool",
    "git add app.js"
];

commands.forEach(command => console.log(command));

Expected output

git mergetool
git add app.js

Questions and answers

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

1 Which action tells Git that a conflict has been resolved?

  • git init
  • git config
  • git add Correct answer
  • git branch

Explanation: The resolved file is staged with git add. This tells Git that the file's conflict has been resolved.

2 Check the File Status After a Conflict

Question
git ____
Answer
git status

Explanation: The git status command lets you check the file's state and staged changes after resolving a conflict.

3 Complete Conflict Resolution

Term Meaning
Conflict markers Identify conflicting sections
Resolve Selects the appropriate content
Mergetool Provides visual comparison
Stage Prepares the resolved file

All lessons in Intermediate

20 Intermediate final

  1. Branch management
  2. Rebase
  3. Conflict
  4. PR flow