Junior — Middle
How is conflict resolution carried out when merging branches in a version control system?
sobes.tech AI
Answer from AI
When merging branches in a version control system (e.g., Git), conflicts may occur if changes in different branches affect the same lines in files.
Conflict resolution occurs as follows:
- The system attempts to automatically merge changes (automatic merge).
- If changes are incompatible, a conflict arises, and Git marks the conflicting sections in files with special markers:
<<<<<<< HEAD code from the current branch ======= code from the branch being merged >>>>>>> feature-branch - The developer manually edits the file, choosing the correct version or merging changes.
- After resolving conflicts, files are added to the index and committed.
Thus, conflict resolution requires understanding the context of changes and deciding which code to keep.