Resolving a merge conflict in a specific file means opening that file, manually reconciling the conflicting sections, and then staging and completing the merge once the correct content is in place.
Key Points: • Git pauses the merge and inserts conflict markers directly into abc.java at the exact lines that differ between the two branches. • Open the file, review both versions between the markers, and edit it down to the single correct version of the code. • Remove the <<<<<<<, =======, and >>>>>>> markers completely; leaving them in place would break the file. • Run git add abc.java to tell Git the conflict in that file is resolved and ready to be committed. • Complete the merge with git commit (Git often pre-fills a merge commit message), then verify the change builds and tests pass.
Example: Merging feature-y into main conflicts in abc.java where both branches changed the same method; after manually combining the correct logic and removing the markers, running git add abc.java and git commit finishes the merge cleanly.
Code Example:
git add abc.java
git commitInterview Tip: A concise interview answer is:
"I'd open abc.java, look at the sections between the conflict markers, and manually keep the correct combined logic, then delete the markers. After that, git add abc.java stages the fix and git commit finishes the merge."