简体   繁体   English

使用GIT-SVN创建的GIT仓库分叉的限制?

[英]Limitations on forking from a GIT repo created with GIT-SVN?

Many open-source projects (eg django ) have GIT mirrors which are, in turn, forked for private or public development. 许多开源项目(例如django )都有GIT镜像,而这些镜像又用于私人或公共开发。 GIT mirrors are kept up to date with git svn rebase . GIT镜像与git svn rebase保持git svn rebase But the Pro Git Book contains this unequivocal recommendation: Pro Git Book包含了这个明确的建议:

Ahh, but the bliss of rebasing isn't without its drawbacks, which can be summed up in a single line: 啊,但是变相的幸福并非没有缺点,可以用一条线来概括:

Do not rebase commits that you have pushed to a public repository. 不要将已推送到公共存储库的提交重新绑定。

If you follow that guideline, you'll be fine. 如果你遵循这个准则,你会没事的。 If you don't, people will hate you, and you'll be scorned by friends and family. 如果你不这样做,人们会恨你,你会被朋友和家人嘲笑。

When you rebase stuff, you're abandoning existing commits and creating new ones that are similar but different. 当您重新设置内容时,您将放弃现有提交并创建相似但不同的新提交。 If you push commits somewhere and others pull them down and base work on them, and then you rewrite those commits with git rebase and push them up again, your collaborators will have to re-merge their work and things will get messy when you try to pull their work back into yours. 如果你将提交推送到某个地方而其他人将它们拉下来并依赖它们,然后你用git rebase重写这些提交并再次推送它们,那么你的协作者将不得不重新合并他们的工作,当你试图将事情变得混乱把他们的工作拉回你的工作。

Are open-source mirrors like Django's breaking the bolded rule above about not rebasing in a public repo? 像Django这样的开源镜像打破了上面关于不在公共回购中进行变基的粗体规则吗? If not, why not? 如果没有,为什么不呢? If so, what can't be done using these mirrors that can be done with "regular" non-rebased Git projects? 如果是这样,使用这些镜像可以通过“常规”非重新定位的Git项目完成什么? Apologies if this is an obvious question; 如果这是一个明显的问题,请道歉; I'm a Git newbie. 我是一个Git新手。

The idea is: 这个想法是:

  • whatever Git branch is the direct result of a git svn rebase should not be rebased: its history must be kept as originally imported, in order to make successful dcommit 无论Git分支是什么, git svn rebase的直接结果都不应该重新定位:它的历史必须保持原始导入,以便成功进行dcommit
  • any other Git branch (not directly linked to a SVN branch) can be merged/rebased at will. 任何其他Git分支(不直接链接到SVN分支)都可以随意合并/重新组合。

See also Easy merging in svn using git-svn . 另请参阅使用git-svn在svn中轻松合并

So if the branches affected by merge/rebase in various Django repo are not the ones involved with dcommit (to sync back to a SVN repo), it should be fine. 因此,如果受各种Django仓库中的merge / rebase影响的分支不是与dcommit相关的分支(同步回SVN仓库),那应该没问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM