Subject: Re: [PATCH resend] make "git push" update origin and mirrors, "git push --mirror" update mirrors

From: Paolo Bonzini <[email-masked]>
Date: Sun, 27 Apr 2008 09:23:23 +0200

> Sorry, I don't really see a use case behind this.  `git push` today
> will push to origin all branches that exist both locally and already
> on the remote.  If you want to push to multiple locations, just
> specify the other URLs in the remote.origin.url configuration list.
> Linus added support for that years ago.

I publish my topic branches (with --mirror) on my personal site, and the 
master and stable branches on savannah.gnu.org.

>> Similarly, if a developer uses the integrator's repository but
>> wishes to publish his own mirror somewhere, he can just do "git push
>> --mirror".
> 
> Why not just have a remote named "my-mirror" and do `git push my-mirror`?

More precisely, it would be "git push && git push --mirror mirror".  My 
previous patch to add remote.<foo>.mirror shortens it to eliminate the 
--mirror, but I cannot condense it in one remote because one is mirror 
and the other isn't.

I can do this, in other words:

> For example in egit I can publish to both
> the master egit tree (repo.or.cz/egit.git) and to my fork
> (repo.or.cz/egit/spearce.git).  I publish to the latter almost
> daily, and rebase even more often than that.

... just by choosing whether to work in a topic branch or in a repo that 
is already on git.sv.gnu.org, but from a single checked out tree.  Like 
you guys, I have multiple places to push to -- and I want "git push" to 
DWIM.

Of course I have a git-mirror script that does it, but the use case 
seemed frequent enough to warrant the effort to provide it for other 
users too.

Replying to Junio:

> Configuring to push to multiple can already be done as you described, not
> having to have a special case code like this patch is certainly very
> attractive

I considered actually to change it to "push to every remote that has a 
push refspec", and adding code to "git clone" that added a push refspec 
for origin.  This would simplify the magic, but I wasn't sure of the 
ramifications and of whether it would change the behavior of the default 
remote.

Paolo