mysterious vanishing branches in git

前端 未结 2 567
被撕碎了的回忆
被撕碎了的回忆 2021-01-20 19:14

Here are some git actions I performed. As you can see, I made a new branch, modified my files, and then committed the changes. After changing back to another branch, hoping

2条回答
  •  伪装坚强ぢ
    2021-01-20 19:51

    Well I don't exactly see why the branch 'disappeared' but don't worry, your files didn't.

    You can find them by many means:

    • You can use the message printed by the git checkout when you left your anonymous branch: "Previous HEAD position was 858491f".
    • You can use git reflog and find the commit of your files.

    Then you can run this to recreate the branch:

    git checkout 858491f -b fixed_merge_conflict
    

    and then you can do your merge:

    git checkout develop
    git merge fixed_merge_conflict
    

    Or you can do the merge in one step if you don't care about the branch:

    git merge 858491f
    

提交回复
热议问题