Git fallback to a version of the server correct posture

Source: Internet
Author: User

Background:

In git collaboration, members inevitably commit some wrong versions, and because Git introduces a local repository compared to SVN, the operation is relatively complex, with the following posture decomposition

Find a source file Rsputils.java, plus a line of comments//test fallback git server version, then commit and push, now the version record is as follows (Mac version of Sourcetree for example)

dd5f51f ... Is the problematic version, now we have to fall back to 7a22c8f ... version, check 7a22c8f ... version, right click, pop-up option

Select, reset Master to this commit, and this is the Reset command.

Select Hard mode and then right-click on the latest version record on the current trunk to continue selecting Reset Master to this commit

Select soft Mode

Commit + Push completes the version fallback on the server, and the final version record is as follows:

No message is my last commit version, because no comment, the tool automatically added (the actual work does not write comments or comments written not understand is very bad habit, must be determined to correct)

Note: From the 1th diagram and the last figure can be seen, in the 1th figure, I have not submitted records uncommited changes, after reset hard lost, so everyone in the fallback version must keep a clear mind, use reset hard

Overview of the whole posture (principle):

Reset-hard XXX Discard Local modification fetch server overwrite off local
Rest-soft XXX Points The local pointer to the latest version of the trunk
Commit
Push

Git fallback to a version of the server correct posture

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.