The common way to merge

Usage scenarios and processes:

  1. Master branch has c1 and C2 commit;
  2. Pull new branch dev from master branch for development, submit C3, C4, C5;
  3. At this point someone else has merged a commit C6 branch into the master branch;
  4. Git checkout Master (git checkout Master)
  5. Git pull origin master C6 content on the remote master is pulled;
  6. Git merge dev merge git merge dev merge git merge dev merge
  7. 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
  8. 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:

  1. Commit and pull branches in the same way as merge
  2. You need to pull the master branch up to date before using the rebase command
  3. Switch to the branch that requires rebase, in this case the dev branch
  4. Git rebase master Git rebase –continue
  5. Switch to the master branch and execute git merge dev
  6. 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