git reset
実行した各種操作を取り消すコマンド。
用例
- 「test.txt」をaddした処理を取り消す
git reset test.txt
- 直前のcommitを取り消す(ワークツリーのみそのまま)
git reset HEAD^
- 直前のcommitを取り消す(ワークツリーとインデックスはそのまま)
git reset --soft HEAD^
- 直前のcommitを取り消す(ワークツリー、インデックス、コミット全て取り消し)
git reset --hard HEAD^
- リセット前の状態に戻す
git reset --hard ORIG_HEAD
書式
git reset [options] [value]
公式によると以下の通り。
git reset [-q] [<tree-ish>] [--] <pathspec>… git reset [-q] [--pathspec-from-file=<file> [--pathspec-file-nul]] [<tree-ish>] git reset (--patch | -p) [<tree-ish>] [--] [<pathspec>…] git reset [--soft | --mixed [-N] | --hard | --merge | --keep] [-q] [<commit>]
options
/x | xxx |
etc.
説明
実行した各種操作を取り消すコマンド。
- Windowsコマンドプロンプトで「HEAD^」を指定する場合はダブルクォーテーションで囲う必要がある。
(例)"HEAD^"
関連
- xxx
参考リンク
- git reset - Gitコマンド虎の巻
- Git - git-reset Documentation
- xxxxxxxx?
- xxxxxxxx?
- xxxxxxxx?
- xxxxxxxx?
- xxxxxxxx?
- xxxxxxxx?
その他メモ
なにかあれば。