git移植和替换如何不同? (移植现在已弃用?) [英] How do git grafts and replace differ? (Are grafts now deprecated?)

查看:130
本文介绍了git移植和替换如何不同? (移植现在已弃用?)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

git 移植与替换几乎没有Q& A。搜索 [git] + grafts + replace 只发现了两个感觉与5相关的内容。 what-are-git-info-grafts-for git的 - 什么 - 是 - 一 - graftcommit-或-A-移植-ID 。还有关于 git.wiki.kernel.org:GraftPoint 的说明。 p>

过滤器现在完全被超过分支,还是他们仍然需要一些特殊的角落案例(和向后兼容性)?

一般来说,它们是如何不同的在回购之间运输),它们通常如何?
我已经看到Linus在讨论承诺代数时目前不关心移植问题(最大父母回到任何根类)嫁接已经不可靠。



编辑:more info
graft 的搜寻www.kernel.org/pub/software/scm/git/docs只找到3个结果: p>


  1. git-filter-branch(1),

  2. v1.5.4.7 / git-filter-分支(1),
  3. v1.5.0.7 / git-svn(1)。

稍微更广泛的搜索发现 RelNotes / 1.6。 5.txt ,其中包含:



  • refs / replace / hierarchy被设计为可用作替代
    的嫁接机制,还有另外一个好处,即它可以通过存储库转移


不幸的是, gitrepository-layout(5)尚未与refs / replace / repository布局信息保持一致也没有任何信息/移植的弃用票据。



这更接近于支持我的想法,但我欢迎任何确认或澄清。 >

解决方案

同样的讨论关于您提到的提交代号 JakubNarębski 确认移植比解决方案更令人赞叹:


移植物非常可怕,如果它们被使用,我不会反对关闭世代。

在替换物体的情况下,您需要非替换和替换
DAG代数。

[...]嫁接是不可转让的,如果您使用它们来剔除而不是添加
历史,它们是不安全的垃圾收集...我想。


(发布一直由 git filter-branch ,如 2008移植工作流程)。



移民 git替换最好的说明这个 SO问题设置git父母指向不同父母的指针,以及(Jakub的再次回答)

它包含对 Git1.6.5



据我所知(来自 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:

  1. git-filter-branch(1),
  2. v1.5.4.7/git-filter-branch(1),
  3. 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 superseded git 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屋!

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