Skip to content

Instantly share code, notes, and snippets.

@AntumDeluge
Last active June 11, 2026 08:00
Show Gist options
  • Select an option

  • Save AntumDeluge/5f4688622c89286567dbbd627c5d8ba2 to your computer and use it in GitHub Desktop.

Select an option

Save AntumDeluge/5f4688622c89286567dbbd627c5d8ba2 to your computer and use it in GitHub Desktop.
Git aliases for managing multipe mirrors.
[alias]
# use custom alias instead of `git remote` to exclude possible third party forks
myremotes = !echo # add remote names here
fetchmaster = "!f() { echo \"Fetching branch master ...\"; for r in `git myremotes`; do git fetch ${r} refs/heads/master; done; }; f"
pushmaster = "!f() { echo \"Pushing branch master ...\"; for r in `git myremotes`; do git push ${r} master:master; done; }; f"
pushbranch = "!f() { b=`git branch --show-current` && echo \"Pushing branch ${b} ...\"; for r in `git myremotes`; do git push ${r} refs/heads/${b}; done; }; f"
pushfbranch = "!f() { b=`git branch --show-current` && echo \"Force pushing branch ${b} ...\"; for r in `git myremotes`; do git push -f ${r} refs/heads/${b}; done; }; f"
pushtags = "!f() { echo \"Pushing tags ...\"; for r in `git myremotes`; do git push --tags ${r}; done; }; f"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment