Git undo local branch delete

后端 未结 8 1790
慢半拍i
慢半拍i 2020-11-29 14:52

I just deleted the wrong branch with some experimental changes I need with git branch -D branchName.

How do I recover the branch?

8条回答
  •  鱼传尺愫
    2020-11-29 15:33

    Follow these Steps:

    1: Enter:

    git reflog show 
    

    This will display all the Commit history, you need to select the sha-1 that has the last commit that you want to get back

    2: create a branch name with the Sha-1 ID you selected eg: 8c87714

    git branch your-branch-name 8c87714
    

提交回复
热议问题