git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: Can a note be pushed to origin?

From
Jeff King <peff@peff.net>
Date
Sep 27, 2024, 04:15 UTC
Message-ID
<20240927041516.GA568026@coredump.intra.peff.net>
In-Reply-To
<6b69af87-9002-46a7-a5f3-3fa1fb7ba9df@app.fastmail.com>
On Wed, Sep 25, 2024 at 05:29:30PM +0200, Kristoffer Haugsbakk wrote:
> That will refuse to update if your own notes ever diverge from the
> remote.  If you want to always overwrite your local notes with the
> remote ones:

There are some specialized strategies for merging notes (e.g., taking the union of lines). See the "merge" subcommand in git-notes(1).

I don't recall ever really using it myself, and I don't think there's really any porcelain support, so you're on your own to invoke the merge. But I guess the use case would be something like:

  # fetch their notes into a holding spot
  git config remote.origin.fetch refs/notes/commits:refs/notes/origin/commits
  # and then after every fetch, you merge if necessary. By default we're
  # merging into our own "refs/notes/commits". And it should be OK to
  # use the short "origin/commits" here, since notes-refs have their own
  # special lookup rules. Though using the fully qualified refname is
  # probably reasonable, too.
  git fetch
  git notes merge -s union origin/commits
-Peff
Previous: Kristoffer HaugsbakkNext: Kristoffer Haugsbakk
Message 3 of 4 in “Can a note be pushed to origin?”
  1. Stephen P. SmithSep 25, 2024
  2. Kristoffer HaugsbakkSep 25, 2024
  3. Jeff KingSep 27, 2024
  4. Kristoffer HaugsbakkSep 28, 2024

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.