致命:引用的格式无效:'refs / heads / master〜' [英] fatal: Reference has invalid format: 'refs/heads/master~'
问题描述
git分支
git分支-a
git拉
git log --pretty = format:%C(黄)%h%信誉%d \\%Cblue [%cn] \\%Creset%s--decorate --graph
git log --online --decorate --graph
我得到错误 p>
致命:引用的格式无效:'refs / heads / master〜'
但是下面的命令可以工作:
git log - oneline --graph#removed --decorate
git log
正在运行
find ./ -iname* conflict *
不会返回任何结果。
输出 find ./ -name* master *| grep\。/ \.git
是
./。git / logs / refs / heads / master
./.git/logs/refs/heads/master~
./.git/logs/refs/remotes/origin/master
./.git/refs / heads / master
./.git/refs/heads/master~
./.git/refs/remotes/origin/master
不知道这是否有帮助,但我在里面看到 master〜
。
任何想法可能是错误的?我可以提供哪些其他信息?
它看起来像一些实用程序创建了正常分支文件的备份 .git / refs / heads /...
),结尾为〜
字符。这是不允许Git中的分支名称,因为它们会与用于获取祖先的后缀记法 ...〜N
冲突。
不需要查询所有裁判的命令(例如 git log master
,而不是 - 装饰
)正在工作,但试图列出所有分支的任何内容都会阻塞无效的分支名称。
只需删除文件 ./。git / refs /头/主〜
(备份后),你应该很好。
When I try any of these commands:
git branch
git branch -a
git pull
git log --pretty=format:"%C(yellow)%h%Cred%d\\ %Cblue[%cn]\\%Creset %s" --decorate --graph
git log --online --decorate --graph
I get the error
fatal: Reference has invalid format: 'refs/heads/master~'
But the following commands work:
git log --oneline --graph # removed --decorate
git log
Running
find ./ -iname "*conflict*"
doesn't return any results.
The output of find ./ -name "*master*" | grep "\./\.git"
is
./.git/logs/refs/heads/master
./.git/logs/refs/heads/master~
./.git/logs/refs/remotes/origin/master
./.git/refs/heads/master
./.git/refs/heads/master~
./.git/refs/remotes/origin/master
Don't know if that helps, but I see master~
in there.
Any idea what might be wrong? What other info can I provide you with?
It looks like some utility has created "backups" of the normal branch files (.git/refs/heads/...
) with a trailing ~
character. This are not allowed branch names in Git as they would conflict with the suffix notation ...~N
for obtaining ancestors.
Commands that don't need to query all refs (such as git log master
without --decorate
) are working but anything that tries to list all branches is choking on the invalid branch name.
Simply delete the file ./.git/refs/heads/master~
(after backing it up) and you should be good to go.
这篇关于致命:引用的格式无效:'refs / heads / master〜'的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!