Does github keep deleted remote branches in history? If so, can those be restored?

后端 未结 5 1122
暗喜
暗喜 2020-12-02 14:15

I was wondering if there is a way to restore a remote deleted branch in github. History clearly keeps record of the branch and merges with other branches but I\'m not sure i

5条回答
  •  野趣味
    野趣味 (楼主)
    2020-12-02 14:58

    git reflog will show you the history of HEAD. If the branch you deleted was named foo, then in that output, you should see lines like 48534f5 HEAD@{0}: checkout: moving from master to foo or 48534f5 HEAD@{1}: merge foo: Fast-forward. You can search the output of git reflog to figure out which commit must be the latest one that foo pointed to.

    Do realize, that the "foo" reflog file itself is deleted when foo was deleted, but since the HEAD's reflog is different it still exists.

提交回复
热议问题