Git记录细节

编程入门 行业动态 更新时间:2024-10-25 22:26:15
本文介绍了Git记录细节的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

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

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

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

问题:

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

    推荐答案

    作为每周精选系列.

    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记录细节

    本文发布于:2023-11-23 01:46:08,感谢您对本站的认可!
    本文链接:https://www.elefans.com/category/jswz/34/1619665.html
    版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
    本文标签:细节   Git

    发布评论

    评论列表 (有 0 条评论)
    草根站长

    >www.elefans.com

    编程频道|电子爱好者 - 技术资讯及电子产品介绍!