git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Robert Dailey <rcdailey.lists@gmail.com>
Cc: Git <git@vger.kernel.org>
Subject: Re: How to git push mirror local refs only?
Date: Sat, 10 Jun 2017 10:53:00 +0900	[thread overview]
Message-ID: <xmqqpoec4nib.fsf@gitster.mtv.corp.google.com> (raw)
In-Reply-To: <CAHd499BBNsai4SScOe6kADsgbGRLyGnDKyUcm8LZL-w8c9Webw@mail.gmail.com> (Robert Dailey's message of "Fri, 9 Jun 2017 11:12:22 -0500")

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






  reply	other threads:[~2017-06-10  1:53 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-09 16:12 How to git push mirror local refs only? Robert Dailey
2017-06-10  1:53 ` Junio C Hamano [this message]
2017-06-19 14:20   ` Robert Dailey
2017-06-19 17:58     ` Junio C Hamano

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=xmqqpoec4nib.fsf@gitster.mtv.corp.google.com \
    --to=gitster@pobox.com \
    --cc=git@vger.kernel.org \
    --cc=rcdailey.lists@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).