.git / info / grafts是做什么用的?

时间:2020-03-06 15:01:20  来源:igfitidea点击:

我试图弄清楚Git中的"移植"是什么。

例如,在这里的最新评论之一中,Tobu假设使用git-filter-branch和.git / info / grafts来连接两个存储库。

但是我不明白为什么我需要这些移植物?看来,所有这些工作都不需要最后两个命令。

解决方案

从Git Wiki:

Graft points or grafts enable two
  otherwise different lines of
  development to be joined together. It
  works by letting users record fake
  ancestry information for commits. This
  way you can make git pretend the set
  of parents a commit has is different
  from what was recorded when the commit
  was created.
  
  Reasons for Using Grafts
  
  Grafts can be useful when moving
  development to git, since it allows
  you to make cloning of the old history
  imported from another SCM optional.
  This keeps the initial clone for users
  who just wants to follow the latest
  version down while developers can have
  the full development history
  available.
  
  When Linus started using git for
  maintaining his kernel tree there
  didn't exist any tools to convert the
  old kernel history. Later, when the
  old kernel history was imported into
  git from the bkcvs gateway, grafts was
  created as a method for making it
  possible to tie the two different
  repositories together.