What are .git/info/grafts for?

匿名 (未验证) 提交于 2019-12-03 09:58:14

问题:

I am trying to figure out what is the 'grafts' in the Git.

For example, in one of the latest comments here, Tobu suppose to use git-filter-branch and .git/info/grafts to join two repositories.

But I don't understand why I need these grafts? It seems, that all work without last two commands.

回答1:

From 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.



回答2:

When working with git-svn:

git grafts are very useful to import a Git tree into a Subversion repository.

E.g. I created a local Git repository as a start. After working on it several days, creating lots of commits, I had to publish it into the central Subversion repository and I didn't want to lose the history.

I found the following How-to article: http://eikke.com/importing-a-git-tree-into-a-subversion-repository/



转载请标明出处:What are .git/info/grafts for?
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!