LoginSignup
135

More than 5 years have passed since last update.

削除したbranchを復活させる

Posted at

誤って削除してしまったbranchを元に戻す方法

reflogして過去の作業を一覧する

git reflog HEAD

復活させたいbranchとHEADの番号をコピペ

c939342 HEAD@{0}: pull: Fast-forward
fb488d2 HEAD@{1}: checkout: moving from feature/hogehoge to develop
7f4b273 HEAD@{2}: checkout: moving from feature/hogehoge to feature/fugafuga

復活させる

git branch feature/hogehoge HEAD@{2}

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
135