git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* How to git push mirror local refs only?
@ 2017-06-09 16:12 Robert Dailey
  2017-06-10  1:53 ` Junio C Hamano
  0 siblings, 1 reply; 4+ messages in thread
From: Robert Dailey @ 2017-06-09 16:12 UTC (permalink / raw)
  To: Git

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.

Thanks in advance.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: How to git push mirror local refs only?
  2017-06-09 16:12 How to git push mirror local refs only? Robert Dailey
@ 2017-06-10  1:53 ` Junio C Hamano
  2017-06-19 14:20   ` Robert Dailey
  0 siblings, 1 reply; 4+ messages in thread
From: Junio C Hamano @ 2017-06-10  1:53 UTC (permalink / raw)
  To: Robert Dailey; +Cc: Git

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






^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: How to git push mirror local refs only?
  2017-06-10  1:53 ` Junio C Hamano
@ 2017-06-19 14:20   ` Robert Dailey
  2017-06-19 17:58     ` Junio C Hamano
  0 siblings, 1 reply; 4+ messages in thread
From: Robert Dailey @ 2017-06-19 14:20 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Git

On Fri, Jun 9, 2017 at 8:53 PM, Junio C Hamano <gitster@pobox.com> wrote:
> 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.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: How to git push mirror local refs only?
  2017-06-19 14:20   ` Robert Dailey
@ 2017-06-19 17:58     ` Junio C Hamano
  0 siblings, 0 replies; 4+ messages in thread
From: Junio C Hamano @ 2017-06-19 17:58 UTC (permalink / raw)
  To: Robert Dailey; +Cc: Git

Robert Dailey <rcdailey.lists@gmail.com> writes:

> On Fri, Jun 9, 2017 at 8:53 PM, Junio C Hamano <gitster@pobox.com> wrote:
>> 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
>>> ...
>> 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.

It may, as a good general default to something other than --mirror,
perhaps.  When I ask for mirroring the state of my repository, I'd
expect it to preserve as much state as possible, including the tips
of histories I received from elsewhere.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2017-06-19 17:58 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-06-09 16:12 How to git push mirror local refs only? Robert Dailey
2017-06-10  1:53 ` Junio C Hamano
2017-06-19 14:20   ` Robert Dailey
2017-06-19 17:58     ` Junio C Hamano

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).