【问题标题】:fatal: your current branch appears to be broken致命的:您当前的分支似乎已损坏
【发布时间】:2019-08-20 20:08:17
【问题描述】:

我在使用的时候报这个错误

 git log

致命:您当前的分支似乎已损坏

我的分支文件被破坏了 我在记事本中打开了 .git/refs/heads/mybranch 但我只看到了一些 ?????? 在文件中

我知道我必须找到分支哈希并将其复制到 .git/refs/heads/mybranch 文件中 但我不知道如何找到那个哈希

我读过这个话题 Broken branch in git, fatal: your current branch appears to be broken

【问题讨论】:

  • 我建议尝试git checkout -b new_branch 创建一个新分支,然后git branch -D mybranch 删除您原来的分支。然后您可以将new_branch 重命名为您想要的任何名称。注意:这假设您当前与mybranch 处于同一提交状态。

标签: git git-branch git-bash


【解决方案1】:

最后,在非常痛苦之后,这对我有用

1 get backup from your .git directory
2 open file .git\logs\refs\heads\<branch name> with your editor 
3 copy second hash of your last line
4 open file .git\refs\heads\<branch name> and delete everything in this file
5 past that hash to .git\refs\heads\<branch name>

【讨论】:

    猜你喜欢
    • 2016-01-05
    • 1970-01-01
    • 2017-04-06
    • 2013-05-23
    • 2020-03-18
    • 2014-09-11
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多