How does git roll back a single file to a specified version?

Source: Internet
Author: User

1. Go to the file directory where the file is located, or find the file path.


View File Modification records
Git log mainactivity. Java

2. Roll Back to the specified version

Git reset f7a220761c312d47013c394d750528f9acbc3099 mainactivity. Java

3. Submit to local

Git commit mainactivity. Java-M "reset to revision"

4. Update to the working directory

Git checkout mainactivity. Java (or git pull. Update the entire directory)

5. Submit to remote Repository

Git push origin head: refs/For/branch name


In this way, the specified file is rolled back to the specified version.

How does git roll back a single file to a specified version?

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.