Re: Can a note be pushed to origin?
Hi
On Wed, Sep 25, 2024, at 14:25, Stephen P. Smith wrote:
Show 9 quoted lines
> 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