diff options
| author | Mitja Felicijan <mitja.felicijan@gmail.com> | 2023-06-27 14:50:20 +0200 |
|---|---|---|
| committer | Mitja Felicijan <mitja.felicijan@gmail.com> | 2023-06-27 14:50:20 +0200 |
| commit | 8697555125c57ae64a0c9b78514b4aac4fd523de (patch) | |
| tree | a699df53a7c35a4425f30bca86982c4341f6de40 /content/posts/2023-05-10-push-to-multiple-origins-at-once-in-git.md | |
| parent | 33b2615a5038bc85036081e8b5e0da8584d88097 (diff) | |
| download | mitjafelicijan.com-8697555125c57ae64a0c9b78514b4aac4fd523de.tar.gz | |
Massive formatting and added figcaption
Diffstat (limited to 'content/posts/2023-05-10-push-to-multiple-origins-at-once-in-git.md')
| -rw-r--r-- | content/posts/2023-05-10-push-to-multiple-origins-at-once-in-git.md | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/content/posts/2023-05-10-push-to-multiple-origins-at-once-in-git.md b/content/posts/2023-05-10-push-to-multiple-origins-at-once-in-git.md index 3d07072..adef7e9 100644 --- a/content/posts/2023-05-10-push-to-multiple-origins-at-once-in-git.md +++ b/content/posts/2023-05-10-push-to-multiple-origins-at-once-in-git.md | |||
| @@ -5,21 +5,20 @@ date: 2023-05-10T12:00:00+02:00 | |||
| 5 | draft: false | 5 | draft: false |
| 6 | --- | 6 | --- |
| 7 | 7 | ||
| 8 | This is a quick one. I use my personal Git server as my main server, and I use | 8 | This is a quick one. I use my personal Git server as my main server, and I use |
| 9 | GitHub only as a mirror. As a result, I constantly forget to push to GitHub. | 9 | GitHub only as a mirror. As a result, I constantly forget to push to GitHub. |
| 10 | 10 | ||
| 11 | To push to multiple origins at once in Git, you can create a custom Git alias | 11 | To push to multiple origins at once in Git, you can create a custom Git alias or |
| 12 | or use a script to automate the process. Here's an example of how you can | 12 | use a script to automate the process. Here's an example of how you can achieve |
| 13 | achieve this using a Git alias: | 13 | this using a Git alias: |
| 14 | 14 | ||
| 15 | ```sh | 15 | ```sh |
| 16 | git config --global alias.pushall '!sh -c "git remote | xargs -L1 git push --all"' | 16 | git config --global alias.pushall '!sh -c "git remote | xargs -L1 git push --all"' |
| 17 | ``` | 17 | ``` |
| 18 | 18 | ||
| 19 | This command creates a Git alias called `pushall` which, when executed, will | 19 | This command creates a Git alias called `pushall` which, when executed, will |
| 20 | push the changes to all the remote repositories associated with the current | 20 | push the changes to all the remote repositories associated with the current |
| 21 | repository. To use it, simply run `git pushall` instead of `git push` when | 21 | repository. To use it, simply run `git pushall` instead of `git push` when you |
| 22 | you want to push to all the remote repositories at once. | 22 | want to push to all the remote repositories at once. |
| 23 | 23 | ||
| 24 | That's all, folks. | 24 | That's all, folks. |
| 25 | |||
