All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Kristoffer Haugsbakk" <kristofferhaugsbakk@fastmail.com>
To: "Stephen P. Smith" <ishchis2@gmail.com>
Cc: git@vger.kernel.org
Subject: Re: Can a note be pushed to origin?
Date: Wed, 25 Sep 2024 17:29:30 +0200	[thread overview]
Message-ID: <6b69af87-9002-46a7-a5f3-3fa1fb7ba9df@app.fastmail.com> (raw)
In-Reply-To: <20240925122515.14015-1-ishchis2@gmail.com>

Hi

On Wed, Sep 25, 2024, at 14:25, Stephen P. Smith wrote:
> In a project that I am working on, some metadata is currently embedded in some
> source files.  The question was asked yesterday if there is a way to move that
> metadata a git specific file and link it to the source file or commit.
>
> I remembered that git has notes which can be used to add such data to a
> commit, but I don't believe that such metadata gets pushed to origin nor
> fetched from origin but another user.
>
> Is there a currently implemented way to do something like this?

You have to do it manually.

In `.git/config`:

```
[remote "origin"]
	url = <url>
        […]
	fetch = refs/notes/commits:refs/notes/commits
```

That fetches the default Notes ref on `git fetch origin`.

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:

```
[remote "origin"]
	url = <url>
        […]
	fetch = +refs/notes/commits:refs/notes/commits
```

But then you should also enable reflog updates for all refs:

```
git config set --global core.logAllRefUpdates always
```

In case you do a fetch that you want to undo.

-- 
Kristoffer Haugsbakk


  reply	other threads:[~2024-09-25 15:29 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-09-25 12:25 Can a note be pushed to origin? Stephen P. Smith
2024-09-25 15:29 ` Kristoffer Haugsbakk [this message]
2024-09-27  4:15   ` Jeff King
2024-09-28  9:52     ` Kristoffer Haugsbakk
  -- strict thread matches above, loose matches on Subject: below --
2024-09-25 12:29 Stephen Steves Linda Smith
2024-10-02  1:37 ` Carlisle T. Hamlin
2024-10-02  1:39   ` Carlisle T. Hamlin
2024-09-25 12:07 Stephen P. Smith

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=6b69af87-9002-46a7-a5f3-3fa1fb7ba9df@app.fastmail.com \
    --to=kristofferhaugsbakk@fastmail.com \
    --cc=git@vger.kernel.org \
    --cc=ishchis2@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.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.