How does Git cancel commit, how do You cancel the commit after Git commit, and how do you change the commit content
When you’re using Git, you might accidentally click commit, so how do you plug in the commit?
1. You can first check the historical commit record with Git Reflog
Soft, soft
The local code does not change, except that git transitions revert to the pre-COMMIT state
Do not delete the workspace change code, undo commit, and do not undo Git Add.
git reset --soft HEAD~1
Represents the last commit to be revoked, and 1 can be replaced with an earlier number
Hard to cancel
The native code will change directly to the specified commit version. Use with caution
Delete the workspace change code, undo commit, undo Git Add.
Note that after this operation, the last COMMIT state is restored.
git reset --hard HEAD~1
If the message content is just COMMIT, the error is filled in
The input
git commit --amend
Enter ViM mode and make changes to Message
There’s another one, mixed
git reset --mixed HEAD~1
Do not delete the workspace change code, undo commit, and undo git Add. Operation
is the default parameter,git reset –mixed HEAD~1 and git reset HEAD~1 have the same effect.
Read More:
- How to solve the problem of “please enter a commit message to explain why this merge is necessary” when git merges branches?
- [Solved] ERROR: commit 60acc70: missing Change-Id in message footer
- pathspec commit did not match any files known to git
- gerrit error: missing Change-Id in commit message footer
- How to Cancel pending transactions on Ethereum
- How to batch comment and cancel Python code
- Git commit encountered error: pathspec (Fixed)
- Mybatis openSession.commit () manually submit data and openSession.commit (true) automatically submit data
- [Git] git pull pull remote git push to remote git commit submit reject
- Failed to commit changes to dconf: the connection is closed
- Solve “error: failed to commit transaction” in arch Linux
- Common solutions to errors in checkout or commit of SVN
- Spring failed to commit the transaction
- After switching the tidb database, an error could not commit JDBC transaction appears from time to time
- The COMMIT TRANSACTION request has no corresponding BEGIN
- (gedit:10072): dconf-WARNING **: failed to commit changes to dconf: connection closed
- !!!! You must write Log Message,at least 5 characters. Commit aborted !!!!
- GitHub desktop upload file error commit failed – exit code 1 received
- An error occurred while loading commit signatures
- Commit failed – exit code 1 received