git pushall

git add remote "all"

It starts to become bothersome having to push to multiple remote repos (i.e. Github and my nas) manually one-by-one. Linus Torvalds, the creator of git, mentioned1 back in 2006 that he uses the following method:

So for "git push" (where it makes sense to push the same branches multiple times), you can actually do what I do:

- .git/config contains:

        [remote "all"]

                url = master.kernel.org:/pub/scm/linux/kernel/git/torvalds/linux-2.6

                url = login.osdl.org:linux-2.6.git

- and not "git push all master" will push the "master" branch to both of those remote repositories.

However, he notes a few issues around fetching, and I think this can be simplified by using some git features that probably didn't exist back in 2006.

git alias pushall

So why not create an alias?

git config --global alias.pushall '!git remote | xargs -L1 git push --all'

Now I can easily push to every remote using git pushall.


  1. https://marc.info/?l=git&m=116231242118202&w=2