Here is one way to only select specific branches from a remote location:
Refs (including branches) that are retrieved from the remote are managed using the remote.<remote-name>.fetch
. For example, your remote.origin.fetch
is probably refspec:
+refs/heads/*:refs/remotes/origin/*
... this means that you can get the names of all the links in refs/heads/
in the remote repository and make them available in refs/remotes/origin/
in your local repository. ( +
means forced updates, so your remote tracking branches can be updated even if the update is not fast-forward.)
Instead, you can list several refspecs that indicate specific branches to retrieve, for example. changing it like this:
git config remote.origin.fetch +refs/heads/master:refs/remotes/origin/master git config --add remote.origin.fetch +refs/heads/blah:refs/remotes/origin/blah
... and then next time we select only master
and blah
.
Of course, you already have a lot of remote tracking branches locally, and gitk
will still show them. You can delete all those that do not interest you:
git branch -r -d origin/uninteresting
source share