About git merge helper
Merging combines the work of one branch into another. Choose between a normal merge, a squash merge or a fast-forward.
Options
- A normal merge keeps the full history and adds a merge commit.
- A squash merge combines all commits into one for a clean main branch.
- git merge --abort cancels a merge that hit conflicts.
Resolving conflicts
Open the files marked as conflicted, choose the right code between the <<<<<<< and >>>>>>> markers, remove the markers, then git add and commit.
A worked example
To bring main's latest work into your feature branch, run git switch feature and git merge main. For a tidy history on main, merge your branch with git merge --squash feature and then commit once. If you change your mind mid-merge, git merge --abort puts everything back.
Merge, squash or rebase
- Merge keeps the full history, including when branches joined.
- Squash gives one clean commit per feature.
- Rebase gives a straight line but rewrites history, so use it only on your own branches.
