Rebase operation of git operation

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.