Re: Can a note be pushed to origin?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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






[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux