1
0

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 3 years have passed since last update.

Git コミットを一部削除する方法

Posted at

#GitHubでコミットを一部のみ削除する方法
##結論

ターミナル
git reset <コミットID>

#コミットID?????
##commit IDの出し方

ターミナル
git log

#git logでブワーッと下記のようになる
git07_01.png
#上記のcommit 5daf90338461・・・5から5までのランダムな英数字混合がコミットIDです!
#削除したい該当のコミットのIDをresetすれば・・・

ターミナル
git reset 5daf90338461ead0665b16bf02f9fbfafbba7da5

#特定のコミットだけが削除された状態になります
##注意点としてはこの方法はコミットしてpushする前の状態の説明なのでpushしてしまった後の削除法につきましては以下の記事などを参考にしてみて下さい!

###参考Qiita記事
@Maeda-Shoota
~Git困ったぞこれ集~
https://qiita.com/Maeda-Shoota/items/56d5fddccf5e89bbeba0

1
0
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
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?