Push to multiple origins at once in Git

This is a quick one. I use my personal Git server as my main server, and I use GitHub only as a mirror. As a result, I constantly forget to push to GitHub.

To push to multiple origins at once in Git, you can create a custom Git alias or use a script to automate the process. Here’s an example of how you can achieve this using a Git alias:

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

This command creates a Git alias called pushall which, when executed, will push the changes to all the remote repositories associated with the current repository. To use it, simply run git pushall instead of git push when you want to push to all the remote repositories at once.

That’s all, folks.


Want to comment or have something to add?

You can write me an email at m@mitjafelicijan.com or catch up with me on Telegram.


Read more from this site


Articles from blogs I follow around the net

Manufacturers opinion

tags: i2c, plan9 Another month, another file system. Something a bit more interesting this time. An environmental sensors, to be connected to the humble “server”: bme6…

Via WLOG - blog on June 5, 2023
Burnout

It kind of crept up on me. One day, sitting at my workstation, I stopped typing, stared blankly at the screen for a few seconds, and a switch flipped in my head. On t…

Via Drew DeVault's blog on May 1, 2023

Generated with openring.