Labs ICT
โญ Pro Login

Merge Branches

Merging brings changes from one branch back into another. This is how you integrate features and fix bugs into your main codebase. Usually this works smoothly, but when two branches modify the same lines, you get a merge conflict that needs manual resolution.

Branch Merging

`git merge branch-name` combines changes. If the branches have diverged without modifying the same lines, you get a fast-forward merge. When conflicts happen, Git pauses the merge and lets you edit the conflicting files manually. After resolving, commit to continue.

$ git checkout main
$ git merge feature-auth
$ git mergetool
$ git add file-with-conflict.txt
$ git commit
Try it Yourself โ†’

๐Ÿงช Quick Quiz

What does 'git merge' do?