混帐:如何避免重复与子子子...混帐-repos犯?(Git: how to avoid repet

2019-06-23 11:22发布

我有很多次-repos,这意味着有更小的回购一个大伞回购。 现在,当我做了一个叶回购承诺,它会自动意味着我得到了其父母的变化。 如果假设结构为二叉树,你可能会意识到这是荒谬的-有5混帐回购深层结构很可能意味着$ git commit -m 'did 1'; cd ..; git commit -m 'did 1 as mentioned'; ... git commit -m 'did 1 same as earlier' $ git commit -m 'did 1'; cd ..; git commit -m 'did 1 as mentioned'; ... git commit -m 'did 1 same as earlier' $ git commit -m 'did 1'; cd ..; git commit -m 'did 1 as mentioned'; ... git commit -m 'did 1 same as earlier' 。 我怎样才能避免这种重复犯?

实施例1:关于该问题的图形示例

 X---------| | Y---------A --------| | B --------|<-----Pictures (graphic designers, animators--have repo) | C --------| 

在图片的变化将改变A,B,C,X和Y - 臃肿的承诺,6个提交由于一个变化,坏的重复! 现在人们使用图片可以是完全不同的人,以人做与X,Y,A,B和C的事情,使事情变得更加模糊不清。

例2:手工上-example审判与子子... -repos

请复制此手在-example 这里 。 您可以使用3级-sub-回购有测试的东西。

到目前为止建议

  1. Git中基本的子模块,更在这里 。

  2. Gitslave 这里 。

Answer 1:

不要创建存储库中库。 这将避免重复提交。 可能会解决其他一些问题。

如果你真的认为你有仓库内需要仓库,然后使用子模块。



Answer 2:

这可能是你的设计或结构很差,也许是背后GoZoner的命令的前提下"Don't create repositories within repositories." ,但它也有可能是你的项目已经到了需要更强大的工具的一个点。 还有,当基本的子模块是不够的,你的回购过于宽泛,那么你或许应该看看时间 - GitSlave! 它是 - 工具在您指定的超级-repo然后从回购的工作流。 相反,重复commiting的,你可以使用控释片-command -手工这里 。

相关主题

  • Git的方法:一种工具来管理和构建项目?

  • 不知道你是否应该使用Gitslave? 阅读一个小介绍这里有一个演练。



Answer 3:

Do the files in your repositories often come with associated changes with other files in other repositories? If so, multiple repositories is not your friend. You should only use multiple repositories when they are completely (or almost completely) independent of one another.

On the other hand, if they are completely independent, then you can just use separate repositories. Then, to build some sort of master project that might use files from each repository (ie, it depends on the other repositories) then you use a submodule.

A repository being a submodule of another repository means that it depends on that submodule. Dependency-links between submodules is probably a bad idea if the API is not stable, but if the API is stable so changes in one won't directly impact the other (ie, no code changes necessary), then two top-level submodules can depend upon each other.

Now, I've been talking about submodules the whole time, but an alternative exists called "subtree" if you want to check that out to see what you prefer. Its in the contrib/ section of the main git repository so it isn't installed by default. Also there exists the subtree strategy (ProGit chapter linked to in a comment)



文章来源: Git: how to avoid repetitive committing with sub-sub-sub… Git -repos?