'Preventing error Your configuration specifies to merge with the ref 'refs/heads/Feature/MyFeatureBranch' from the remote, but no such ref was fetched?
When I do a git pull, I'm getting a
Your configuration specifies to merge with the ref 'refs/heads/Feature/MyFeatureBranch' from the remote, but no such ref was fetched.
My .git/config looks like:
[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 status I see:
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
git ls-remote shows me:
a5389a71eea0f30dfa96cfc95f4c19bb57a5d1a6 refs/heads/feature/MyFeatureBranch
I've searched around including the suggestions here and it doesn't seem that I have any of the common problems that result in this error message.
Thanks,
Solution 1:[1]
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.
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
git pull
to verify if it can pull now.
Solution 2:[2]
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
git checkout -t origin/MyFeatureBranch
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Sachin Chitran |
| Solution 2 | MattA |
