Git version fallback, GitHub version fallback

Source: Internet
Author: User
Tags using git

The changes were filed last week and came back over the weekend to undo the last story. So, need to find the version submitted last week, rollback back.

Git version management commands, since the habit of using management tools have little contact, when suddenly looking for other instructions when the paste, Ctrl+k can only be successfully submitted without the management. As a result, tools simplify operations but weaken skills. Like the BBC's 6-minute English conversation a few days ago.

Rob said he was practicing at the bar and was very familiar with the money addition and subtraction algorithm because the computer had not yet been promoted.

The advent of calculators has allowed people to give up their ability to calculate. Sometimes even simply adding and subtracting is not willing to use your own head to calculate. Do not say good or bad, oneself feel very bad, because feel oneself once possessed of skill subsided and sad. Therefore, it is important to strengthen ourselves and not rely entirely on foreign objects.

Managing all of the fallback principles and methods of Git, refer to git code rollback: Reset, Checkout, revert selection. Here, just record the practice I have encountered.

1.reset

A few months ago, I submitted a change that involved dozens of files, submitted to Github,jenkins build, and then health Check 503 error. Look at the error I have no clue, do not understand the health check exactly because of what part of the code caused, this reminds me of the error log must be detailed. But one thing is for sure, the change in this commit is problematic. Since the last time the code is OK, then return it.

I'm locally, using git reset current branch to here. This is Intelij's own git management tool, you can specify the version, and then fallback to the specified version. is essentially the git reset version number.

Obviously, this instruction is to take the head pointer back a bit, that is, the current version is backward. And I submitted from Master's latest reset to the penultimate, then my current version is one submission behind maser.

Now that you've returned, you need to merge to master. The corresponding to GitHub is pull request. However, when I choose the pick request, I show nothing. This change does not need to merge. This means that the version is already included in Master's history, so no merge is necessary.

Therefore, if you want to merge branches, the branch you want to merge must be more advanced than the current branch version. It is clear that resetcan only reset changes locally or in this branch . So, if I want to Mater back, I have to submit a more advanced than Mater and the content is just the opposite of the last commit modification. That's what revert did.

2.revert

Revert version fallback can be achieved with the specified version. This is not a pointer fallback like reset, but a new commit is created, and the modification of the specified version is reversed. In this way, we want to back the content has been modified by the reverse, and our version is more advanced than master. This will allow you to submit it directly.

Git version fallback, GitHub version fallback

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.