4

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,

Community
  • 1
  • 1
Eric
  • 2,861
  • 6
  • 28
  • 59
  • 2
    Does the cases of the branch names match? I'm not sure if you've hand-edited the branches here for posting publicly, but the git ls-remote output shows "feature/MyFeatureBranch" while your git config has "Feature/MyFeatureBranch" - different case for the first character. – jholtrop Jul 01 '16 at 14:40
  • 1
    Try a `git fetch origin MyFeatureBranch` first. What does `git remote show origin` say? – Christoph Jul 01 '16 at 15:17
  • 2
    It was the case sensitivity issue. I changed the case in my git config file. I think I had to do another fetch with the right case. My memory is a little fuzzy right now. – Eric Jul 11 '16 at 19:50

2 Answers2

1

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
MattA
  • 11
  • 1
0

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.