Merge
Notes
To merge two branches, you need to first checkout the branch to merge into. Then start merging:
git merge <branch-name>If there's no conflict, then it will be a fast-forward merge. If there're conflicts, you need to resolve the conflicts.
Resolving conflicts
Conflicts are marked by Git in the file, e.g.
<<<<<<< Updated upstream
this is a new file 5 in branch2
=======
This is file 5.
>>>>>>> Stashed changesYou can either
manually edit the file to the final form; or
tell Git which version to pick using the
--oursor--theirsflaggit checkout --ours <file>--ours: the version from the current branch (the one you checkout beforehand)--theirs: the version from the other branch.
Once the conflicts are resolved, you can then commit the changes.
Last updated