git移植和替换如何不同? (移植现在已弃用?) [英] How do git grafts and replace differ? (Are grafts now deprecated?)
问题描述
git 和 一般来说,它们是如何不同的在回购之间运输),它们通常如何? 编辑:more info 稍微更广泛的搜索发现 RelNotes / 1.6。 5.txt ,其中包含: 不幸的是, gitrepository-layout(5)尚未与refs / replace / repository布局信息保持一致也没有任何信息/移植的弃用票据。 这更接近于支持我的想法,但我欢迎任何确认或澄清。 > 在同样的讨论关于您提到的提交代号 , JakubNarębski 确认移植比解决方案更令人赞叹: 移植物非常可怕,如果它们被使用,我不会反对关闭世代。 (发布一直由 移民和 git替换最好的说明这个 SO问题设置git父母指向不同父母的指针,以及(Jakub的再次回答)。 它包含对 Git1.6.5 移植与
替换
几乎没有Q& A。搜索 [git] + grafts + replace 只发现了两个感觉与5相关的内容。 what-are-git-info-grafts-for 和 git的 - 什么 - 是 - 一 - graftcommit-或-A-移植-ID 。还有关于 git.wiki.kernel.org:GraftPoint 的说明。 p>
过滤器现在完全被超过分支
,还是他们仍然需要一些特殊的角落案例(和向后兼容性)?
我已经看到Linus在讨论承诺代数时目前不关心移植问题(最大父母回到任何根类)嫁接已经不可靠。
的嫁接机制,还有另外一个好处,即它可以通过存储库转移
在替换物体的情况下,您需要非替换和替换
DAG代数。
[...]嫁接是不可转让的,如果您使用它们来剔除而不是添加
历史,它们是不安全的垃圾收集...我想。
git filter-branch
,如 2008移植工作流程)。
据我所知(来自 GraftPoints ),
git replace
已经取代git grafts
(假设你有git 1.6.5或更高版本)
(Jakub :)如果您想
- strong>重写历史,然后
嫁接
+git-filter-branch
(或交互式转化或快速转出+就是这样做的。 - 如果您希望/需要保存历史记录,那么
git-replace
远远优于移植
There are very few Q&A's on git grafts
versus replace
. The search [git] +grafts +replace only found two that felt relevant of the 5. what-are-git-info-grafts-for and git-what-is-a-graftcommit-or-a-graft-id. There is also a note on git.wiki.kernel.org:GraftPoint
Are grafts now completely overtaken by the replace
and filter-branch
, or do they still needed for some special corner cases (and backward compatibility) ?
In general, how do they differ (e.g. which are transported between repos), and how are they generically the same? I've seen that Linus doesn't appear to care about grafts at present in the discussion on commit generation numbers (of the max parents back to any root variety) "Grafts are already unreliable."
EDIT: more info found.
A search of www.kernel.org/pub/software/scm/git/docs for graft
only found 3 results:
- git-filter-branch(1),
- v1.5.4.7/git-filter-branch(1),
- v1.5.0.7/git-svn(1).
A slightly broader search found RelNotes/1.6.5.txt which contains:
- refs/replace/ hierarchy is designed to be usable as a replacement of the "grafts" mechanism, with the added advantage that it can be transferred across repositories.
Unfortunately, the gitrepository-layout(5) isn't yet up to date with the refs/replace/ repository layout info (and notes), nor any deprecation note of info/grafts.
This gets closer to supporting what I was thinking but I'd welcome any confirmation or clarification.
In the same discussion about Commit Generation Number that you mention, Jakub Narębski does confirm that grafts are more aproblem than a solution:
grafts are so horrible hack that I would be not against turning off generation numbers if they are used.
In the case of replace objects you need both non-replaced and replaced DAG generation numbers.
[...] Grafts are non-transferable, and if you use them to cull rather than add history they are unsafe against garbage collection... I think.
(publishing has always been taken care of with git filter-branch
, as illustrated by this 2008 thread on grafts workflow.)
The difference between grafts and git replace is best illustrated by this SO question "Setting git parent pointer to a different parent", and the comments of (Jakub's again) answer.
It does include the reference to Git1.6.5
From what I understand (from GraftPoints),
git replace
has supersededgit grafts
(assuming you have git 1.6.5 or later)(Jakub:)
- if you want to rewrite history then
grafts
+git-filter-branch
(or interactive rebase, or fast-export + e.g. reposurgeon) is the way to do it.- If you want/need to preserve history, then
git-replace
is far superior to graft
这篇关于git移植和替换如何不同? (移植现在已弃用?)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!