Tuesday, 27 August 2013

Way to push a lot of git repos to their remotes

Way to push a lot of git repos to their remotes

I have over 100 git repos on my computer, they are spread out a little
bit. I work a little bit on each of them, and I do not want to push them
manually. But they should be pushed daily to my mirrors.
One partial solution I found is a push-hook that runs a push after each
commit. That would slow me down and prevent rebasing on feature branches
since I would have to consider my work public right away.
I wrote a script that goes through all my git repositories (using find
-name -git -type d) and pushes them to my mirrors, GitHub, Bitbucket and
my server.
The problem I have is that the three remotes, github, bitbucket and chaos
show up as branches. That does not make too much sense, since they are
mirrors, actually.
To get away with that, one can tell git that a remote is a mirror. It does
not show the remote branches in the logs, but I do not have a way of
knowing whether a repo needs pushing. And pushing several hundred
repositories three times takes way too long. My script reads the git log
and checks whether the remote branches are on the master commit, it pushes
otherwise.
Is there some way to do this that feels less hacky?

No comments:

Post a Comment