Junior — Middle
How did you resolve conflicts when merging branches in Git version control system at your previous workplace?
sobes.tech AI
Answer from AI
When conflicts occurred during a Git merge, I usually followed these steps:
- Ran the
git mergecommand and, upon conflict, checked which files were marked as conflicting. - Opened the conflicting files in an editor or IDE, where Git marks conflict sections with special markers (
<<<<<<<,=======,>>>>>>>). - Analyzed the changes in each part and chose which changes to keep: either one of the versions or manually merged the logic.
- After resolving conflicts, saved the files and ran
git addfor each corrected file. - Completed the merge with
git commit, if it did not happen automatically.
For convenience, I sometimes used visual merge tools, such as those built into Xcode or third-party tools like Meld or KDiff3. It is also important to discuss conflicting changes with colleagues to understand the context and avoid losing important data.