git - 致命的:您当前的分支似乎已损坏
问题描述
使用时出现此错误
git log
致命的:您当前的分支似乎已损坏
我的分支文件被破坏了我在记事本中打开了 .git/refs/heads/mybranch 但我只看到一些????????? 在文件中
我知道我必须找到分支哈希并将其复制到 .git/refs/heads/mybranch 文件中,但我不知道如何找到该哈希
我在 git 中阅读了这个主题 Broken branch, fatal: your current branch 似乎已损坏
解决方案
最后,在非常痛苦之后,这对我有用
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>
推荐阅读
- r - R 旋转包含向量的数据框单元格
- javascript - 如何在Javascript中打印一次日期标签
- android - Intellij 2019 2.3 插件 Andriod 支持中的异常
- python - 日期时间转换 ValueError Pandas
- hyperledger-fabric - 使用 vscode 在 ibm 区块链平台中运行 invoke.js 时出错?
- c - C 究竟在哪些情况下会引发分段错误?
- react-native - 在动态端点上打开套接字
- android - 如何修复某些 android 设备(Twilio 可编程视频)中的低远程音频?
- python - “ImportError:C 扩展:没有名为转换的模块未构建。” 同时将外部依赖项传递给 PySparkShell。如何通过外部依赖?
- python - 在 Pandas 中使用 GROUP BY 执行 COUNTIF - Python 3.x