本文介绍了Git记录细节的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已阅读,但仍然认为它们晦涩难懂.到目前为止了解:

I've read this and this but still see them as obscure. By far understood:

  • 创建(git notes add -m "a note")
  • 注释已命名空间

问题:

  1. 注释似乎未创建提交,因此push(示例)是如何显示的对他们来说可能吗?其背后的机制是什么?如果不是提交,从概念上讲,什么是注释添加?
  2. 在Github UI上哪里可以看到我的push ed笔记?
  3. Github之间是否有任何关系 提交评论 人们可以发表并记录功能吗?
  4. 如果Github评论指出了如何获取它们并通过git log在我的本地计算机上看到它们?
  5. 如果Github评论不是 笔记,它们是什么,是否有可能获取它们?
  6. 票据可合并吗?怎么样?
  7. 是否有解决已编辑笔记冲突的警告?
  8. 笔记还有其他问题/困难吗?
  1. notes seem not to create a commit, so how the push (example) is possible for them? what is the mechanism underneath it? what is note addition conceptually if not a commit?
  2. where can I see my push'ed notes on Github UI?
  3. is there any relation between Github commit comments people can make and notes functionality?
  4. if Github comments are notes how can I fetch them and see on them on my local comp via git log?
  5. if Github comments are not notes, what they are and is it possible to fetch them?
  6. are notes mergeable? how?
  7. are there any caveats of resolving conflicts for edited notes?
  8. are there any other problems/difficulities with notes?

谢谢

推荐答案

作为每周精选系列.

http://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:

https://github.com/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:

https://github.com/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:

https://github.com/eclipse/jgit/commit/3abf35bc0fccaac130e8fec42083ad

https://github.com/eclipse/jgit/commit/3abf35bc0fc7a1c130e8fec42083ffd21c342129

如果您在该链接中找到原始Gerrit来源的评论链接:

And if you chase the review link there to the original Gerrit source:

https://git.eclipse.org/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/program1refs/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记录细节的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-20 15:20