git: undo rollback

1. Code revocation

If the normal submission code is to be submitted to the remote warehouse, there are the following 3-step commands:

 git add . ------------> git commit -m 说明 -------------> git push

(Add to staging area) (Submit to local warehouse) (Push to remote warehouse)

In git, the command to revoke the code is mainly git reset, but there are 3 modes: git reset --soft, git reset --hard, and git reset --mixed. These three commands are mainly for the rollback of the code after the warehouse has been submitted, and basically all of them will be rolled back with the commit log version number.

The different meanings of the three modes are as follows:
–soft: This command means that after the undo code is sent to the temporary storage area, the code will not change locally before commit.
–mixed: This command means that the code will not change locally until the code is revoked to the temporary storage area and committed.
–hard: This command means to roll back the code to a certain version, and the code will change to the specified version locally, so be careful.

Emphasize again: –hard command, be careful when using it, it will roll back the code directly and disappear. Even the newly written local ones are cleared.
insert image description here

The code revocation mainly includes the following types of revocation:
submit the revocation of the temporary storage area (add revocation)
submit the local warehouse revocation (commit revocation)
push the remote warehouse revocation (push revocation)

1.add cancel

Guess you like

Origin blog.csdn.net/m0_38127564/article/details/131332524