Git Commands(Git 指令): How To Cancel The Commit You Just Made |如何取消剛剛所做的提交
Published in
Aug 8, 2024
If you want to cancel the commit you just made, you can use the `git reset` command to undo it. Here are the steps to revert the commit:
1. Reset the commit:
To undo the last commit but keep the changes in the working directory, you can use:
git reset HEAD~
This command will reset your branch to the state before the commit, but your changes will remain in the working directory.
2. Check the status:
Verify the changes that are unstaged after the reset:
git status