LoginSignup
2
3

More than 5 years have passed since last update.

git resetで直前のコミット/ステージを取り消す

Last updated at Posted at 2017-08-08

git resetの影響範囲を忘れがちなので、ざっくりとまとめました。

直前のコミットを取り消す

$ git reset --soft HEAD^

直前のコミットのみ取り消す。ステージとワーキングツリーはそのまま。

直前のステージを取り消す

$ git reset HEAD

ステージを取り消す。ワーキングツリーはそのまま。

ワーキングツリーを取り消す

$ git reset --hard HEAD

ステージとワーキングツリーを取り消す。
ファイルの変更自体がなかったことになるので要注意。

以上になります。

2
3
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
2
3