QA
Beginner LevelGit & GitHub

What causes Git Merge Conflicts and how do you manually resolve them?

❓ Interview Prompt: Explain the causes of merge conflicts, interpreting conflict markers (<<<<<<<, =======, >>>>>>>), resolving files, and completing merges.

Merge conflicts occur when Git attempts to merge two branches that modified the exact same line of a file differently. Resolving requires editing conflict markers (<<<<<<<, =======, >>>>>>>), staging files via git add <file>, and running git commit.

Code Implementation Example

javascript
// Conflict Markers:
<<<<<<< HEAD
const apiEndpoint = "https://api.v2.myapp.com";
=======
const apiEndpoint = "https://api.staging.myapp.com";
>>>>>>> feature/staging-config

// Resolved:
const apiEndpoint = "https://api.v2.myapp.com";
💡Resolving Git merge conflict markers in source code files.
🎯 Interview Key Takeaway

Resolve merge conflicts by editing conflict markers (<<<<<<<, =======, >>>>>>>), staging resolved files with git add, and running git commit.

#Merge Conflicts#git merge#Beginner
Back to all Git & GitHub Questions→

More Git & GitHub Interview Questions

Beginner LevelGit & GitHub

Compare git rebase versus git merge and explain how git bisect finds regressions.

Beginner LevelGit & GitHub

What is the difference between git init and git clone?

Beginner LevelGit & GitHub

What are the Three Trees in Git (Working Directory, Staging Area / Index, Commit History)?