git rollback

 

There are two types of git rollbacks, one is to commit to the repository, and the other is to not commit to the repository.

 

1. There are two types of submission to the repository, one is to submit to the local repository, and the other is to submit to the remote repository.

      a) Submit to the local warehouse in the following ways

                i) revert HEAD with git. The feature of this method is that a new commit will be generated. Submit to the remote warehouse directly with git push orign master

               ii) Use git reset --HARD commitId. The feature of this method is to move the pointer directly to a commit. Since the local version is one version less than the remote version, for the -f parameter, use git push origin master -f

 

      b) Commit to the remote repository.

              Ditto. Just push it to the remote server after the local modification is done. The command has been given above.

 

2. Not submitted to the remote warehouse.

      a) in the work area. with git checkout -- <fileName>

      b) in the temporary storage area. with git reset HEAD <fileName>

 

 

Reference: Liao Xuefeng

 

 

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326589428&siteId=291194637