2
1

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 1 year has passed since last update.

【Git】git pullを取り消したいときはgit resetじゃなくgit revertを使おう

Posted at

##git resetは基本使わない

間違えてgit pullしちゃったけどやっぱり取り消したいとき、
調べるとgit reset --hardをすればいいよ!という記事をよく見かけた。

基本的にgit reset --hardは(複数人での開発のときは特に)
ログが変わってしまうため使わないほうが良い。

##git revertを使おう

git revertは取り消したいコミットを打ち消すコミットを作成するので
コミットを消したログもちゃんと残せる。

##参考

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

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?