With modern git you always fetch all branches (as remote-tracking branches into refs/remotes/origin/*
namespace, visible with git branch -r
or git remote show origin
).
By default (see documentation of push.default
config variable) you push matching branches, which means that first you have to do git push origin branch
for git to push it always on git push
.
If you want to always push all branches, you can set up push refspec. Assuming that the remote is named origin
you can either use git config:
$ git config --add remote.origin.push '+refs/heads/*:refs/heads/*'
$ git config --add remote.origin.push '+refs/tags/*:refs/tags/*'
or directly edit .git/config
file to have something like the following:
[remote "origin"]
url = [email protected]:/srv/git/repo.git
fetch = +refs/heads/*:refs/remotes/origin/*
fetch = +refs/tags/*:refs/tags/*
push = +refs/heads/*:refs/heads/*
push = +refs/tags/*:refs/tags/*