Merging feature-y into main gives a conflict in abc.java. How do you resolve it?

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

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.

git add abc.java
git commit

Interview 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.

Last updated: 11 November 2026

Previous question: Your team changes priorities while you work on branch feature-x. How do you put your changes on hold and switch to a new task?

Next question: Your feature branch is several commits behind main. How do you use git rebase to update it?

More Git - Level I interview questions

All Git - Level I questions