4
4

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Gitの取り消し(add, commit)

4
Posted at

直前の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
4
4
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
4
4

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?