我已阅读此和此,但仍然认为它们晦涩难懂.到目前为止了解:
I've read this and this but still see them as obscure. By far understood:
- 创建(git notes add -m "a note")
- 注释已命名空间
问题:
谢谢
推荐答案作为每周精选系列.
alblue.bandlem. com/2011/11/git-tip-of-week-git-notes.html
注释本身是blob,它们存储在单独的引用文件(refs/notes/commits)中,并由它们所指向的提交进行组织(因此git ls-tree refs/notes/commits)给出了一个树对象(认为:目录和内容),其中每个目录名称都是他们要指向的内容,每个值都是一个包含备注消息本身的Blob.
The notes themselves are blobs that are stored in a separate ref file (refs/notes/commits) and are organised by the commit that they are pointing to (so git ls-tree refs/notes/commits) gives a tree object (think: directory and content) where each directory name is the thing they are pointing to and each value is a blob containing the notes message itself.
您可以在GitHub中的JGit审阅树(使用refs/notes/review而不是refs/notes/commit但本质上是完全相同的原理)上查看Gerrit对审阅注释的使用:
You can see Gerrit's use of review notes in the JGit review tree (which uses refs/notes/review instead of refs/notes/commit but essentially exactly the same principle) in GitHub by going here:
github/eclipse/jgit/tree/refs/注释/评论
由于它也是一个引用,并且文件内容的增量与提交一起存储,因此您可以看到各个注释被更改,例如:
Since it's also a ref, and the delta to the file content are stored with commits, you can see the individual notes being changed, for example:
github/eclipse/jgit/commit/de70108c883afe563a48352c05cdd440c25f58cc
请注意,文件名显示为对象的路径;在上述情况下,de70...是添加了消息的提交,但是提交的内容正在更改与该提交相对应的文件3a/bf...:
Note that the name of the file is shown as the path of the object; in the above case, de70... is the commit that added the message, but the content of the commit is changing a file 3a/bf... which corresponds to this commit:
github/eclipse/jgit/commit/3abf35bc0fccaac130e8fec42083ad
github/eclipse/jgit/commit/3abf35bc0fc7a1c130e8fec42083ffd21c342129
如果您在该链接中找到原始Gerrit来源的评论链接:
And if you chase the review link there to the original Gerrit source:
git.eclipse/r/#/c/54632 /
您看到评论数据与notes元素的数据相对应.
you see that the review data corresponds with that of the notes element.
关于它们是否干净合并-由于每个注释对应于每个提交,并且每个提交一旦更改都是不可变的,并且注释提交基于每个目录/文件,因此对于不同的提交重叠,您可以轻松地拥有多个注释无需担心合并冲突.但是,如果两个程序/进程更新相同的提交说明,那么您可能会遇到合并问题,需要以与其他任何DVCS合并相同的方式解决.
As for whether they merge cleanly - since each note corresponds to each commit, and each commit is immutable once change, and the note commit is on a per-directory/file basis, you can easily have multiple notes for different commits overlapping without fear of merge conflict. However if two programs/processes update the same commit note then you may have merge problems that need to be resolved in the same way as any other DVCS merge.
通常来说,需要存储正交信息的程序应该使用自己的注释空间,就像Gerrit对refs/notes/review所做的那样.因此,如果您有refs/notes/program1和refs/notes/program2,则永远不会发生碰撞.
Generally speaking, programs that need to store orthogonal information should use their own notes space, like Gerrit does for refs/notes/review. So if you have refs/notes/program1 and refs/notes/program2 you will never get a collision.
更多推荐
Git记录细节
发布评论