git version of the operating project

1.git version rollback operation:

  <1> modification on the master branch test.txt, vim test.txt, add a description "version1", save and exit the editor

   

 

 <2> all files in the directory added: git add.

 <3>git commit -m "v1"

 <4>git push

At this time, test.txt github lower branch on the master version number V1

<5> test.txt continue to modify the file, vim test.txt, add a description "V2", save and exit the editor

 

 

<6> all files in the directory added: git add.

<7>git commit -m "v2"

<8>git push

At this time, test.txt github lower branch on the master version is V2

<9> Now if you need to roll back to the previous version V1, git command: git reset --hard HEAD ^, f58d703 refers to the version ID number is unique, then fall back V1 version has been found, and You can view test.txt

      

 

  

 

 

If you need to roll back many times the version number, simply modify the git reset --hard HEAD ~ 1000 (fallback version 1000, version numbers) after HEAD

No. <10> need to roll back if a version (version specified), git command can be used: The reflog is git, show all version ID NO:

 

 git reset --hard d0b3abf, you can fall back to v2 version (git reset --hard added followed by the version ID number)

  

 

 

 These are the git version rollback operation

     

Guess you like

Origin www.cnblogs.com/maxwellsky/p/11576035.html
Recommended