2

Consider a remote repository which has some commits and notes associated with each commit. How to pull in the remote branches and the notes ref from the remote repository?

The below command does not retrieve the notes:

git fetch origin refs/notes/commits

any suggestions?

0xc0de
  • 8,028
  • 5
  • 49
  • 75
Iowa
  • 2,171
  • 4
  • 22
  • 31

1 Answers1

2

I've just found it on the Git website:

$ git fetch origin refs/notes/*:refs/notes/*

Or you can put it the repo config .git/config, watch the last line:

[remote "origin"]
  fetch = +refs/heads/*:refs/remotes/origin/*
  url = git@github.com:schacon/kidgloves.git
  fetch = +refs/notes/*:refs/notes/*

The article mentioned above is full of expressions like breaks down, difficult, super difficult and painful. So I'd avoid notes like the plague.

SzG
  • 12,333
  • 4
  • 28
  • 41
  • Notes have been designed as a way to annotate commits in a local repository of a particular developer. So while they indeed could be pushed and fetched (and even [merged](http://stackoverflow.com/q/12055303/720999)), this is not a workflow envisioned for them. So if one sticks to how notes are supposed to work, all should be well. – kostix Sep 11 '13 at 09:52
  • @gbr, to be more precise, I'd possibly politely raise a discussion about improving the manual page of `git notes` to explicitly hint the user that 1) cloning a repository does not clone notes by default; 2) the default setting `git clone` configures for fetchng from the "origin" repository does not attempt to fetch the notes either. Beleive me, constructive suggestions to improve the documentation *are* accepted. – kostix Oct 21 '15 at 15:26
  • @bgr, you might find the first answer in [this discussion](https://groups.google.com/d/topic/git-version-control/vFgGOKIzHzY/discussion) interesting. – kostix Oct 21 '15 at 15:29
  • @kostix There's an excellent reason in venting in letting new potential users get an idea of what git is about. Comments like that old of yours squelch the doubts in git the answer is likely to elicit to one assessing whether to start using it. It's some of those comments that persuaded me to start learning and use git about an year ago, and that choice caused me months of hell at work and in private life, when I have not been fired just because I have a shamefully highly protected job (I've been on the brink nonetheless); I wouldn't be surprised if it caused long-term health problems as well. – gbr Oct 21 '15 at 17:23
  • @kostix I thought I had tamed it right now, even though I have not _yet_ studied its entire source code I thought I got all the pitfalls of the parts I use. Instead yesterday I was f*cked once more (I felt that way, anyhow) by a feature I used extensively and whose traps I thought I already fixed months ago, with the awful notes.rewriteRef thing. So as I'm a person who cares about other people I would like to spare to others my endeavor: don't study git unless you have to, look at Mercurial instead (or other vcs). – gbr Oct 21 '15 at 17:23
  • @kostix (who designed this comment length limit)? – gbr Oct 21 '15 at 17:25
  • @kostix I don't want to be even more involved in git, as soon as I have a little less pressure I'm going to learn Mercurial (which based on what I read is better than paradise wrt git) and bury git in a dark corner of my memory. – gbr Oct 21 '15 at 17:25
  • @kostix I've read a couple things about the interaction with the git maintainers, but even disregarding those: I'm one of the latest developers on earth to have learned git; if the documentation and the software is in this state after ten years and millions of users it's not possible that it's because nobody reported the problems, it means it's extremely hard to have changes approved (and the project has horrible development practices). – gbr Oct 21 '15 at 17:25
  • @kostix As Mercurial, based on what I read, seems to be at the opposite extreme in terms of project management practices, with careful design, discussion and attention to its users, I'll jump on that wagon as soon as possible and don't want to get any closer to git. I'm sure it will die in the coming years, despite (actually stimulated by, probably) its current growing popularity. -- (ok, end of this run of comments) -- – gbr Oct 21 '15 at 17:26
  • @kostix about [that discussion](https://groups.google.com/d/topic/git-version-control/vFgGOKIzHzY/discussion): It's a guy who says "Did I miss something or git notes are actually not meant to be cloned/pulled?" in some discussion group? That doesn't look like great software documentation/specification – gbr Oct 21 '15 at 17:39