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

Source: Internet
Author: User

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

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 to copy git clone to a specified folder

Git clone remoteurl localdir
For example, git clone git@github.com/somerepo. git/home/admin/somerepo
 
How does git list all files submitted by a specific version?

Try git ls-files ~~
 

Related Article

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.