Gaurav
Gaurav

Reputation: 1516

Listing all remote branches with multiple remotes

We have a gitolite server setup and running for use within our team. The parent for my local git repository is a central svn repo. The gitolite server has been added as a remote and I am able to push and pull from it. Everything works fine except that I cannot see the branches that are created on the remote server even after I do

git remote update

I checked the .git/config file and I see that the tracking is set up as

[remote "origin"]
    url = git@server:project
    fetch = +refs/heads/master:refs/remotes/origin/master

If I manually change this to

[remote "origin"]
    url = git@server:project
    fetch = +refs/heads/*:refs/remotes/origin/*

then I can see all remote branches also on origin.

My question is, is it possible for me to ask git to track everything on remote when I add it? If not, are these manual changes safe?

Upvotes: 1

Views: 81

Answers (1)

VonC
VonC

Reputation: 1329042

Yes, the modifications are safe, and you can even add more of those rules: see Set up git to pull and push all branches (for tags and for push).

If you want to track all branches from remote, you can refer to this one-liner from the question "Track all remote git branches as local branches".
That will modify or create the config of each local branches in order for them to track their remote counterpart.

Upvotes: 1

Related Questions