Reputation: 11
I tried and also google it but never solve this problem. I found this command git reset --hard HEAD^ it also doesn't work.
Upvotes: 1
Views: 124
Reputation: 11
The git reset --hard HEAD^ instruction does not remove a commit by definition. It just forces the branch to point to the previous (parent) commit (^) on your local repository. To have the same status on the remote repository, you need to force push using git push <remote (default: origin)> <target_branch> --force. Be aware this push can erase others' works. You can use --force-with-lease instead of --force for more secure use.
Upvotes: 1