I'm not supposed to commit to dev branch directly, but I accidentally committed something but hasn't pushed it yet, what should I do if I want to cancel it without affecting anything else?
I found a command online: git reset --hard HEAD^
can I use it?
You can just use it without --hard flag
git reset HEAD~1