How do you resolve merge conflicts in Git?

How do you resolve merge conflicts in Git?

a) Manually edit the conflicting files and commit the changes
b) Run git resolve
c) Delete the conflicting files
d) Reset the repository to a previous state

Answer:

a) Manually edit the conflicting files and commit the changes

Explanation:

To resolve merge conflicts in Git, you must manually edit the conflicting files to reconcile the changes, then stage and commit the resolved files. Git marks the conflicting sections in the files, and it’s up to you to decide which changes to keep.

After resolving the conflicts, you can commit the changes with a new commit.

This process is essential for integrating code from different branches when changes have been made to the same parts of a file.

Reference:

Top 100 Git and GitHub MCQ Questions and Answers

Scroll to Top