What is a conflict in Git?

What is a conflict in Git?

a) When two branches have changes to the same lines of code
b) When a file is deleted
c) When a file is added
d) When the repository is corrupted

Answer:

a) When two branches have changes to the same lines of code

Explanation:

A conflict in Git occurs when two branches have made changes to the same lines of code or the same file, and Git is unable to automatically merge them. This typically happens when different developers make changes to the same part of the codebase.

When a conflict occurs, Git will mark the conflicting sections in the file, and it’s up to the developer to manually resolve the conflict by choosing which changes to keep.

Understanding how to resolve conflicts is crucial for collaborative development, ensuring that all team members’ changes are properly integrated into the project.

Reference:

Top 100 Git and GitHub MCQ Questions and Answers

Scroll to Top