I have a remote from which I fetch only one branch:
[remote "upstream"]
url = ....
fetch = +refs/heads/foo:refs/remotes/upstream/foo
I want to add another branch to the set of branches I fetch from this same remote.
I know I can edit local .git/config
and add a second fetch clause by hand:
[remote "upstream"]
url = ....
fetch = +refs/heads/foo:refs/remotes/upstream/foo
fetch = +refs/heads/bar:refs/remotes/upstream/bar
Ergo, I can invoke the git config
magic to do same thing without editing the config file:
git config --local --add remote.upstream.fetch +refs/heads/bar:+refs/remotes/origin/bar
Both approaches (mentioned, in particular, in answers to another question) look quite low-level to me. Is there a higher level git command to add a branch to the set of remote refs, just like remote add -t <branch> ....
that was initially used to create the single branch refs?