Reputation: 11
Imagine I have 4 repositories: [A, B, C, D] I would like to use a simple git command to update them all at the same time.
I expect to use something like:
git push all
Any ideas?
Upvotes: 1
Views: 64
Reputation: 5660
Git itself doesn't have this - its commands only ever apply to things at the repo level - but it's quite simple in bash:
for repo in a b c d; do cd ~/$repo && git push; done
Replace "a b c d" in there with the repo names or paths, and adjust the cd command accordingly. You could also wrap this in a shebang.
Upvotes: 0
Reputation: 38734
Just add all repos as remotes and make an alias that pushes to all of them like
git config alias.push-all '!git push remote-a && git push remote-b && git push remote-c'
Then you can use git push-all
to push to all remotes. If one fails because of non-fast-forward or whatever, solve the issue and just do it again, or manually push to the remotes individually.
Upvotes: 1