diff options
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 | 15 |
1 files changed, 11 insertions, 4 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 7d22950..3d07072 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 | |||
| @@ -1,18 +1,25 @@ | |||
| 1 | --- | 1 | --- |
| 2 | title: Push to multiple origins at once in Git | 2 | title: Push to multiple origins at once in Git |
| 3 | url: push-to-multiple-origins-at-once-in-git.html | 3 | url: push-to-multiple-origins-at-once-in-git.html |
| 4 | date: 2023-05-10 | 4 | 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 GitHub only as a mirror. As a result, I constantly forget to push to GitHub. | 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 | 10 | ||
| 10 | 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: | 11 | To push to multiple origins at once in Git, you can create a custom Git alias |
| 12 | or use a script to automate the process. Here's an example of how you can | ||
| 13 | achieve this using a Git alias: | ||
| 11 | 14 | ||
| 12 | ```sh | 15 | ```sh |
| 13 | 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"' |
| 14 | ``` | 17 | ``` |
| 15 | 18 | ||
| 16 | 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. | 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 | ||
| 21 | repository. To use it, simply run `git pushall` instead of `git push` when | ||
| 22 | you want to push to all the remote repositories at once. | ||
| 17 | 23 | ||
| 18 | That's all, folks. | 24 | That's all, folks. |
| 25 | |||
