Replies: 1 comment
-
To remove the last commit from git, you can simply run: git reset --hard HEAD^ WARNING: This command will ignore your entire commit and your changes will be lost completely from your local working tree. If you want to undo your commit, but you want your changes in the staging area (before commit just like after git add) then do the following command. git reset --soft HEAD^ References: |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I just erroneously made a commit adding a new file in
main
. But I needed to add it to a new branch. How to delete it?Beta Was this translation helpful? Give feedback.
All reactions