public inbox for git@vger.kernel.org 
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox•com>
To: Brooke Kuhlmann <brooke@alchemists•io>
Cc: Taylor Blau <me@ttaylorr•com>, git@vger•kernel.org
Subject: Re: Git Commit Notes (fetching/pushing)
Date: Mon, 07 Aug 2023 09:14:10 -0700	[thread overview]
Message-ID: <xmqq4jlaj0dp.fsf@gitster.g> (raw)
In-Reply-To: <2301E39E-B70D-485B-AFA8-F8DA64B366A2@alchemists.io> (Brooke Kuhlmann's message of "Mon, 7 Aug 2023 08:02:46 -0600")

Brooke Kuhlmann <brooke@alchemists•io> writes:

> I ended up using the following configuration in order to
> explicitly fetch/push branches, notes, and tags:
>
> [remote "origin"]
> 	url = https://github.com/bkuhlmann/test
> 	fetch = +refs/heads/*:refs/remotes/origin/*
> 	fetch = +refs/notes/*:refs/notes/*
> 	fetch = +refs/tags/*:refs/tags/*
> 	push = +refs/heads/*:refs/remotes/origin/*

This will push your local branches (e.g. refs/heads/xyzzy) to their
remote-tracking branches (e.g. refs/remotes/origin/xyzzy) of the
same name.  Is that what you meant?  It is unclear what kind of use
you have your remote repository for, and in some use cases, it is
perfectly valid if a push from here is used as a substitute for a
fetch from there to arrange the push from here like how you have
above, to push into refs/remotes/origin/* of a remote repository
with a working tree.

But often, a remote is used as a publishing point (i.e. everybody
pulls from and only you push into it) or as a central meeting place
(i.e. everybody pulls from and pushes into it), and in these cases,
a push refspec would look more like

	push = refs/heads/*:refs/heads/*

This is especially true when the remote is a bare repository, or
hosted at a hosting site you or nobody has access to its working
tree.

Note the lack of leading '+'; that is absolutely essential if you
are pushing into a central meeting place because you want to avoid
force pushing that will clobber others' work, and it is also a great
discipline even if you are pushing into your publishing point
because those in your downstream will be disrupted if you rewind
your history.



  reply	other threads:[~2023-08-07 16:14 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-06 18:35 Git Commit Notes (fetching/pushing) Brooke Kuhlmann
2023-08-06 20:09 ` Taylor Blau
2023-08-06 21:49   ` Brooke Kuhlmann
2023-08-07  1:07     ` Junio C Hamano
2023-08-07 14:02       ` Brooke Kuhlmann
2023-08-07 16:14         ` Junio C Hamano [this message]
2023-08-07 20:18           ` Brooke Kuhlmann

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

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

  git send-email \
    --in-reply-to=xmqq4jlaj0dp.fsf@gitster.g \
    --to=gitster@pobox$(echo .)com \
    --cc=brooke@alchemists$(echo .)io \
    --cc=git@vger$(echo .)kernel.org \
    --cc=me@ttaylorr$(echo .)com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox