Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Setting up Git to fetch all remote branches

Tags:

git

I somehow ended up with a git configuration with the following in the [remote] section:

fetch = +refs/heads/master:refs/remotes/origin/master

This of course means that I would never ever see branches that my collaborators have added. I realize that I need to change this to:

fetch = +refs/heads/*:refs/remotes/origin/*

but I am confused as to why my configuration ended up this way in the first place, and more importantly, how I can avoid it ever happening again. Any idea how to set up a repo so that it does not do this?

Thanks, cf

like image 713
Chris Fonnesbeck Avatar asked Jun 22 '12 19:06

Chris Fonnesbeck


1 Answers

It sounds like you used git remote add -t master origin url/to/origin/.git. The -t master switch overrides the fetch refspec to only fetch that one branch. If you skip the -t master then you'll get the expected glob refspec.

like image 199
Lily Ballard Avatar answered Sep 18 '22 04:09

Lily Ballard