The common way to merge
Usage scenarios and processes:
- Master branch has c1 and C2 commit;
- Pull new branch dev from master branch for development, submit C3, C4, C5;
- At this point someone else has merged a commit C6 branch into the master branch;
- Git checkout Master (git checkout Master)
- Git pull origin master C6 content on the remote master is pulled;
- Git merge dev merge git merge dev merge git merge dev merge
- Git push origin master then commits the local merged master branch to the remote branch. Both the local and remote master are up to date
- Finally, merge the local master into the dev branch and push dev remotely (git checkout dev; git merge master ; git push origin dev ) ; The dev branch is up to date both remotely and locally;
Above nonlinear submission;
Rebase way
Usage scenarios and processes:
- Commit and pull branches in the same way as merge
- You need to pull the master branch up to date before using the rebase command
- Switch to the branch that requires rebase, in this case the dev branch
- Git rebase master Git rebase –continue
- Switch to the master branch and execute git merge dev
- Commit (C3, C4, C5); commit (C3, C4, C5); commit (C3, C4, C5); However, all commits are copied and retained, and the commit record is linear across the master branch