Junior — Middle
How is the merging of two branches in a version control system performed through the merge operation?
sobes.tech AI
Answer from AI
Merging two branches in a version control system, such as Git, involves combining changes from one branch into another. When performing a merge:
- You switch to the target branch (e.g.,
master). - You execute the command
git merge <branch_name>to combine changes from the specified branch. - Git attempts to automatically merge the changes. If there are no conflicts, the merge completes successfully.
- If there are conflicts (the same lines changed in both branches), they need to be resolved manually.
Example commands:
git checkout master
git merge feature-branch
After a successful merge, a new merge commit appears in the history, which combines the changes from both branches.