diff options
| author | Mitja Felicijan <mitja.felicijan@gmail.com> | 2023-05-17 04:16:18 +0200 |
|---|---|---|
| committer | Mitja Felicijan <mitja.felicijan@gmail.com> | 2023-05-17 04:16:18 +0200 |
| commit | 1cada77c08e23289dfff443d66cabbd92ec7e77d (patch) | |
| tree | 80b131517be8956572b269afe0272b3fc2ce950e | |
| parent | 21e78ffdd4d2e16ca65c2e7b03a2fbea16e52ad9 (diff) | |
| download | mitjafelicijan.com-1cada77c08e23289dfff443d66cabbd92ec7e77d.tar.gz | |
Added post: Push to multiple origins at once in Git
| -rw-r--r-- | content/posts/2023-05-10-push-to-multiple-origins-at-once-in-git.md | 18 |
1 files changed, 18 insertions, 0 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 new file mode 100644 index 0000000..7d22950 --- /dev/null +++ b/content/posts/2023-05-10-push-to-multiple-origins-at-once-in-git.md | |||
| @@ -0,0 +1,18 @@ | |||
| 1 | --- | ||
| 2 | title: Push to multiple origins at once in Git | ||
| 3 | url: push-to-multiple-origins-at-once-in-git.html | ||
| 4 | date: 2023-05-10 | ||
| 5 | draft: false | ||
| 6 | --- | ||
| 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. | ||
| 9 | |||
| 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 | |||
| 12 | ```sh | ||
| 13 | git config --global alias.pushall '!sh -c "git remote | xargs -L1 git push --all"' | ||
| 14 | ``` | ||
| 15 | |||
| 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. | ||
| 17 | |||
| 18 | That's all, folks. | ||
