Chris Fonnesbeck
Chris Fonnesbeck

Reputation: 4203

Setting up Git to fetch all remote branches

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

Upvotes: 9

Views: 216

Answers (1)

Lily Ballard
Lily Ballard

Reputation: 185671

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.

Upvotes: 6

Related Questions