git 防止错误 您的配置指定与来自远程的 ref 'refs/heads/Feature/MyFeatureBranch' 合并,但未获取此类 ref?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/38147665/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Preventing error Your configuration specifies to merge with the ref 'refs/heads/Feature/MyFeatureBranch' from the remote, but no such ref was fetched?
提问by Eric
When I do a git pull, I'm getting a
当我执行git pull 时,我得到一个
Your configuration specifies to merge with the ref 'refs/heads/Feature/MyFeatureBranch' from the remote, but no such ref was fetched.
您的配置指定与来自远程的 ref 'refs/heads/Feature/MyFeatureBranch' 合并,但未获取此类 ref。
My .git/config looks like:
我的 .git/config 看起来像:
[core]
bare = false
repositoryformatversion = 0
filemode = false
symlinks = false
ignorecase = true
logallrefupdates = true
[remote "origin"]
url = https://mycompanysgitserver
fetch = +refs/heads/*:refs/remotes/origin/*
[branch "0019"]
remote = origin
merge = refs/heads/0019
[branch "develop"]
remote = origin
merge = refs/heads/develop
[branch "Feature/MyFeatureBranch"]
remote = origin
merge = refs/heads/Feature/MyFeatureBranch
If I do a git statusI see:
如果我执行git status我会看到:
On branch Feature/MyFeatureBranch Your branch is behind 'origin/Feature/MyFeatureBranch' by 3 commits, and can be fast-forwarded. (use "git pull" to update your local branch) nothing to commit, working directory clean
在分支 Feature/MyFeatureBranch 您的分支落后 'origin/Feature/MyFeatureBranch' 3 次提交,并且可以快进。(使用“git pull”来更新你的本地分支)无需提交,工作目录干净
git ls-remote shows me:
git ls-remote 显示我:
a5389a71eea0f30dfa96cfc95f4c19bb57a5d1a6 refs/heads/feature/MyFeatureBranch
I've searched around including the suggestions hereand it doesn't seem that I have any of the common problems that result in this error message.
我已经四处搜索,包括此处的建议,但似乎没有任何导致此错误消息的常见问题。
Thanks,
谢谢,
回答by Sachin Chitran
I had a similar issue and it was as a result of the remote branch getting deleted. Incidentally, I had finished changes on my branch 'A' and merged it to 'master'. After sometime, I probably did a git fetch --prune to remove all stale references and this might have caused it. However, on the local branch, I was trying to do a git pull and obviously it failed.
我有一个类似的问题,这是因为远程分支被删除了。顺便说一句,我已经完成了对我的分支“A”的更改并将其合并到“master”。一段时间后,我可能做了一个 git fetch --prune 来删除所有陈旧的引用,这可能是导致它的原因。但是,在本地分支上,我尝试执行 git pull 并且显然失败了。
Please run
请跑
git status
状态
on your current local repo and ensure you are on a valid branch. You could switch over to another branch say 'master' and do a
在您当前的本地存储库上,并确保您位于有效的分支上。你可以切换到另一个分支说“master”并做一个
git pull
拉
to verify if it can pull now.
验证它现在是否可以拉。
回答by MattA
To see a list of local and remote branches run, and confirm the remote branch exits
查看运行的本地和远程分支列表,并确认远程分支退出
git branch --all
If you don't have any changes delete the local MyFeatureBranch
, then run
如果您没有任何更改,请删除本地MyFeatureBranch
,然后运行
git checkout -t origin/MyFeatureBranch