LoginSignup
4
2

More than 5 years have passed since last update.

GitHubでRevertする

Posted at

問題

pushするとき、git push origin <branch-name>:masterでpushした、masterでmergeした。しかし、masterでpushしたくないで、今のbranchでpushしたい。

そのために、Revertする。

Revertの使い方

  • まずは今のlogを検査する:

git log -2

image.png

  • revertを実行する:

git revert <commit-hashcode>

ここは:

git revert b1a0b4c0cf32c11bd6f3890d6cbc4a7964c85642

image.png

Revertが成功した。

自分のブランチにpushする。

  • 先の編集を戻る:

git cherry-pick <commit-hashcode>

  • pushする:

git push origin <branch-name>

以上。

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