Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have several remotes added in my repository. I'm only intrested in their master branches, but if I run

git fetch --all


git remote update

then all their branches are fetched. Is it possible to set up git, so it fetches only changes on remotes' master branches and it doesn't create any new remote-tracking branches?

share|improve this question
Why do you mind keeping all tracking branches? – Vi. Oct 6 '10 at 22:00
up vote 5 down vote accepted

You can edit .git/config and change

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

to, for example,

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

Also you can do git fetch origin +refs/heads/master:refs/remotes/origin/master each time instead of just git fetch

You can create fetching script (like "gfm") to avoid inputting that string each time. This way you can use "gfm" to fetch just master and "git fetch" to fetch everything.

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .