Re: How to git push mirror local refs only?
- From
- Robert Dailey <rcdailey.lists@gmail.com>
- Date
- Jun 19, 2017, 14:20 UTC
- Message-ID
- <CAHd499Aft6yE=8f8DGRVxMYNR5kg6AVs3tECVtz1VDdwFeL5fg@mail.gmail.com>
- In-Reply-To
- <xmqqpoec4nib.fsf@gitster.mtv.corp.google.com>
On Fri, Jun 9, 2017 at 8:53 PM, Junio C Hamano <gitster@pobox.com> wrote:
Show 28 quoted lines
> Robert Dailey <rcdailey.lists@gmail.com> writes: > >> So I want to update my remote fork with all my local branches. >> Normally I'd do this: >> >> $ git push --mirror fork >> >> However this will also push everything under `refs/remotes` which I do >> not want. And it fails if I specify a refspec parameter with --mirror. >> >> Is there a way to achieve this through one or more git commands? Note >> I'm doing this on a non-bare clone and have to keep it that way since >> I'm pushing branches I actively work on. >> >> An intrinsic benefit of what I'm trying to do is that the mirror >> command will also batch delete branches on the remote that do not >> exist locally, which is behavior I want since I do not need them >> anymore. > > Something along this line in your .git/config: > > [remote "fork"] > url = ... > push = refs/heads/*:refs/heads/* > > and then > > $ git push --prune --follow-tags fork
Sorry for the late reply, I was out of town all last week. Thanks for your help. Does this serve as a good general default? I can't imagine a case where I'd ever want to push something inside refs/remotes.