Subject: Re: Git Commit Notes (fetching/pushing)

From: Junio C Hamano <[email-masked]>
Date: Mon, 07 Aug 2023 09:14:10 -0700

Brooke Kuhlmann <[email-masked]> 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.