gitgithooksgit-notes

How to make git notes to pull automatically for everyone who clones repo?


Is it possible at all?

I've read in documentation that you can configure it in your local .git/config like:

[remote "origin"]
  fetch = +refs/heads/*:refs/remotes/origin/*

But it is local settings and as i understand i can't push it to i.e. github or bitbucket. Is it possible to force everyone to pull notes?


Solution

  • Is it possible to force everyone to pull notes?

    (emphasis mine) No.

    [remote "origin"]
        fetch = +refs/heads/*:refs/remotes/origin/*
    

    This is the normal setting. You need to add a setting to copy notes references. There are many possible ways to do that, e.g., if you never make your own notes:

    [remote "origin"]
        fetch = +refs/heads/*:refs/remotes/origin/*
        fetch = refs/notes/commits:refs/notes/commits
    

    If you do make your own notes, you will want something fancier, e.g.:

    [remote "origin"]
        fetch = +refs/heads/*:refs/remotes/origin/*
        fetch = +refs/notes/commits:refs/notes/origin/commits
    

    and then manipulate the core.notesRef setting and/or use --notes= when running git log.

    Everyone who wants the notes, however, must specifically ask for the notes, by adding an extra fetch line to their configurations.