Revoke, modify commit
- The process of writing code, if you have
git add [files]
git -m commit [files]
, do not push the code to a remote repository, to withdraw commit, according to the actual situation, with the following parameters.
Parameter Description
--mixed This is the default parameter
meaning is: do not remove the code workspace changes, revocation of commit, and undogit add .
operations.
Thatgit reset --mixed HEAD^
and thegit reset HEAD^
effect is the same.
--soft retained performed when the code changes git commit command, only the revocation git commit -m [files] commit the content.
Means: you can continue to modify the code that is native only withdraw commit, git does not withdraw the last of the add operation.
--hard delete a workspace changes to the code commit revoked, and the revocation git add.
Note: After completion of this operation, it is restored to the last commit state.
If only commit the comment was wrong, just want to change it notes, only need to:
git commit --amend
modify commit the content.