隐藏条目如何成为HEAD提交和索引提交的子提交? [英] How is a stash entry a child commit of HEAD commit and index's commit?

查看:68
本文介绍了隐藏条目如何成为HEAD提交和索引提交的子提交?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

git stash的手册页

隐藏项表示为提交,其树记录了状态 目录,它的第一个父目录是在HEAD的提交 创建条目的时间.第二个父级的树记录了 进行输入并使其成为以下项的子项时索引的状态 HEAD提交.血统图看起来像这样:

A stash entry is represented as a commit whose tree records the state of the working directory, and its first parent is the commit at HEAD when the entry was created. The tree of the second parent records the state of the index when the entry is made, and it is made a child of the HEAD commit. The ancestry graph looks like this:

       .----W
      /    /
-----H----I

其中H是HEAD提交,I是记录状态的提交 索引,W是记录工作状态的提交 树.

where H is the HEAD commit, I is a commit that records the state of the index, and W is a commit that records the state of the working tree.

在示例中,隐藏条目由commit W表示吗?

In the example, is the stash entry represented by commit W?

隐藏项的提交W具有两个父级IH是什么意思?

What does it mean by the stash entry's commit W having two parents I and H?

W是(双向或三向)合并两个提交IH的结果吗?

Is W the result of (two-way or three-way) merging the two commits I and H?

谢谢.

推荐答案

在该示例中,隐藏条目由提交W表示吗?

In the example, is the stash entry represented by commit W?

是的-或者更恰当地说,不是,它由提交W 提交I表示,但是W足以找到 I. W I之一都可以找到H,而git stash会自动找到所有三个提交.

Yes—or more properly, no, it's represented by commit W and commit I, but W suffices to find I. Either of W or I suffices to find H, and git stash will find all three commits automatically.

隐藏项的提交W具有两个父级IH是什么意思?

What does it mean by the stash entry's commit W having two parents I and H?

没什么特别的.这对于git stash apply和其他git stash函数来说,找到IH都变得更加容易(非常非常容易).

Nothing special. That just makes it easier—very very slightly easier—for git stash apply and other git stash functions to find both I and H.

文档中未显示的是隐藏的 third 提交.第三次提交是可选的;仅在使用-a/--all-u/--include-untracked时才存在.第三次提交是W的第三个父级.存储代码将测试是否存在该第三父代,以确定该存储是两次提交存储还是三次提交存储.

Not shown in the documentation is the third commit of a stash. This third commit is optional; it is present only if you used -a / --all or -u / --include-untracked. The third commit is the third parent of W. The stash code will test to see if that third parent exists, in order to decide whether the stash is a two-commit stash or a three-commit stash.

(第三次提交(如果存在的话)具有根提交的形式,因为它没有父项.它的独特之处在于它只保存并仅保留未跟踪的文件,并且根据所使用的标志也可能会被忽略,而根本不保留任何工作树文件.我通常将第三次提交称为U.)

(The third commit, if present, has the form of a root commit, as it has no parent. It's also peculiar in that it holds exactly and only files that were untracked, and maybe also ignored depending on which flag you used, without holding any of the work-tree files at all. I typically call the third commit U.)

W是(双向或三向)合并两个提交IH的结果吗?

Is W the result of (two-way or three-way) merging the two commits I and H?

不.隐藏代码仅使用(滥用?)合并提交使用的 form ,但目的不同:将两个或有时三个提交提交为易于检查的隐藏形式要检查的代码.然后,特殊名称refs/stash可以保存W提交的哈希ID,其他提交也位于该哈希ID中.

No. The stash code is merely using (abusing?) the form that merge commits use, but for a different purpose: to wedge two, or sometimes three, commits into an easy-to-inspect form for the stash code to inspect. The special name refs/stash can then hold the hash ID of the W commit, from which the other commit(s) are located.

(git stash代码利用特殊的临时索引文件进行WU提交.进行I提交更容易:它直接运行git write-treegit commit-tree.)

(The git stash code makes use of special temporary index files to make the W and U commits. Making the I commit is easier: it just runs git write-tree and git commit-tree directly.)

这篇关于隐藏条目如何成为HEAD提交和索引提交的子提交?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆