git merge and rebase

Scenario:

(Assuming that the latest branch at the beginning is master)
a modified the branch and made a local commit,
b modified the branch and submitted it remotely.
At this time, the latest branch of the warehouse is b-master submitted by b,
but a has not updated the project, so The latest branch read by a is still master, and
there are two options for committing a

1. Merge (clear timeline)

Find the common ancestor of a and b

Combine a-master and b-master into a new node, new-master

Insert picture description here
2. Rebase (concise)

In accordance with the modified time sequence, connect in series

Insert picture description here
Suggest:

  1. Update before encoding

  2. Update before submitting

  3. Check for compilation errors before submitting

  4. The submission granularity is as small as possible, and the description is as accurate as possible

  5. Modified public documents and notify other members to update as soon as possible

  6. Most importantly, the team's division of labor must be clear

Reference link:
The difference between git merge and git rebase
Do you really understand git rebase?
Git code anti-lost guide (ideal git use)

Guess you like

Origin blog.csdn.net/qq_36636312/article/details/108407141