直前のgit commitの取り消し
ワーキングツリーの変更は残す場合
git reset --soft HEAD^
ワーキングツリーの変更も取り消す場合
git reset --hard HEAD^
zsh: no matches found: HEAD^ とエラーが出た場合は下記のコマンドで取り消せます。
git reset --soft HEAD\^
initial commitの取り消し
$ git update-ref -d HEAD
[zsh: no matches found: HEAD^と出たときの解決策](zsh: no matches found: HEAD^と出たときの解決策)
直前のgit add の取り消し
git reset HEAD