Recently, when learning about Git, there was a question, if two people commit the code, how does this keep the code consistent?
For example, a now commits the code and then succeeds in pushing the code to the server side. But the B commit code can, but push to the server will be error? Because this time the server has a new commit, swollen?
The solution is as follows: (This piece of wood is operated using the command line, using the Turtle (Tortoise))
1. Show all branches. Find the last a commit.
2. Click the B submit to perform the fetch operation. (Make sure you can connect to the sever side)
3. Then mouse click A to submit, perform rebase operation.
4. Now the code is consistent and the push operation is performed.
Some people ask, why not perform merage operations?
Merage uses submissions between different groups, and if the same group commits the Merage submission, it will find the situation:
The result of executing the merage as shown on the left
Perform the rebase operation
From the results of the two graphs, it can be seen clearly that our code framework will be very difficult to see (within the same group) if merage operations are performed every time. So, just the problem with the solution, use the rebase operation.
Rebase operation of git operation