Broken branch in git, fatal: your current branch appears to be broken

前端 未结 9 1289
时光说笑
时光说笑 2021-02-01 12:57

Here is my case:

  • I was working on one branch.
  • Pushed new commits to the remote.
  • Switched back to the master branch.

But suddenly

9条回答
  •  不思量自难忘°
    2021-02-01 13:53

    I meet similar issue on Windows 7. In my case,the current branch file (refer by ./git/HEAD) under \.git\refs\heads was broken.

    I found the hash code of broken current branch on .git\logs\refs\heads with same branch name.

    And I fixed the issue by opening that file (.git\logs\refs\heads\xxx) via notepad and copy the 4th number (the hash code) to (.git\refs\heads\xxx)

提交回复
热议问题