mysterious vanishing branches in git

爱⌒轻易说出口 提交于 2019-12-01 22:14:50

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
hellatan

for some reason, you're getting a detach head situation. I'm not entirely sure how that is caused in a regular git repo, but i've encountered it using git svn (and came up with my own solution here). It might be that the aren't --tracking the upstream repo when you create a new branch. Usually when you get a detached head, when you do a git branch, you will see (asterisk) (no branch) (don't know how to do a literal asterisk with markdown)

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!