Overview
A safe merge sequence is:
- Commit or preserve current work.
- Switch to the branch that should receive changes.
- Run git status and confirm the working tree is clean.
- Run git merge <source-branch>.
- If the merge succeeds, inspect the combined files.
- If a conflict occurs, open each conflicted file.
- Choose or construct the final intended content.
- Remove conflict markers.
- Stage the resolved files.
- Commit the resolution.
Example: synchronize development with main, then merge development into main.
git checkout development
git merge main
Review and test the combined development branch. Then:
git checkout main
git merge development
This order allows development to absorb the latest main changes before main receives the completed development work.