Merging and Conflicts

View saved

Merge a finished branch

Switch to the branch that should receive the work, usually main, then merge the feature branch.

git switch main
git merge feature/fix-typo

Read a successful merge

If histories can combine cleanly, Git creates a merge commit or a fast-forward. Your files update automatically and status is clean.

Recognize a conflict

A conflict means both branches changed the same lines differently. Git pauses the merge and marks the files that need your decision.

git status
# Open the listed files and look for conflict markers:
<<<<<<< HEAD
your current branch version
=======
incoming branch version
>>>>>>> feature/fix-typo

Finish after resolving

Edit the file to the final correct content, remove the marker lines, then stage and commit to complete the merge.

git add README.md
git commit -m "Merge feature/fix-typo; keep corrected title"

Comments

One comment per signed-in account. Comments are saved with this page’s URL.