RSS
 

Solving git Problems with Prune

28 Jan

gitThe more I use git, the more I find that it is not as bullet-proof as I have been led to believe. Though, so far, there seems to always be a way out of a problem. Such is the case when I was unable to update a local branch from our

Your configuration specifies to merge with the ref 'my_branch'
from the remote, but no such ref was fetched.

No matter what I did to recreate my local branch, I could not pull from the remote. Google and StackOverflow was of no help—misdirecting to unhelpful information. It turned out that even through I’d fetched the current state of the remote server, my index was still showing a remote branch that did not really exist. Running the following command cleaned that up—and all was well:

$ git remote prune origin
Pruning origin
URL: git@github.….com:….git
 * [pruned] origin/my_branch
$ _

For some reason there was a phantom remote branch that fetch did not update in my local index, properly. Otherwise prune is pretty innocuous, so it might be worth running, every once-in-a-while to make sure that your index is an accurate reflection of the remote.

Enhanced by Zemanta
 
 

Tags: ,

 
%d bloggers like this: