Git和多个存储库 [英] Git and multiple repositories

查看:88
本文介绍了Git和多个存储库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用github来存储我的PowerShell配置文件。我发现了 posh-vcs ,我想在我的实际实施上使用它。我希望能够将来自 posh-vcs 的更改合并到我当前的环境中。



处理这个问题的最佳方法是什么?只需要为我的文件存储一个存储库,并在另一个文件夹中有posh-vcs?或者这是叉子的适当使用?即分叉项目并添加我自己的文件,在合适时从父项目合并?

在两个存储库之间,您可以尝试


  • 为他的项目分叉

  • 将您的历史记录导入此分叉回购



  • 如果您想回馈到外部回购,那么分叉只是有趣的。

    如果不是,您可以简单地克隆外部回购并通过移植文件导入您的历史记录,更改 repo(没有任何与vcs后期回购的链接)






    其他选项包括:




    • 考虑外部回购作为回购的子树(子树合并策略

    • 考虑外部回购作为您的子模块回购(如果您需要从后期vcs回购中推送/拉出,同时管理您自己的回购,则非常方便) 问题中的选项回购交易,此有关子模块的更多答案

      I'm using github to store my PowerShell profile. I found posh-vcs that I'd like to use on top of my actual implementation. I'd like to be able to merge changes from posh-vcs to my current environment.

      What would be the best way to handle this? Just have one repository for my files, and in another folder have the posh-vcs? Or is this an appropriate use of the Fork? i.e., fork the project and add my own files, merging from the parent project when appropriate?

      解决方案

      If you have a similar structure between the two repositories, you can try a grafts technique to:

      • fork his project
      • import your history into this forked repo

      The fork is only interesting if you want to contribute back to that external repo.
      If not, you can simply clone the external repo and import your history through the grafts file, changing your repo (without any link with the post-vcs repo)


      Other options involves:

      • considering the external repo as a subtree of your repo (subtree merge strategy)
      • considering the external repo as a submodule of your repo( quite handy if you need to push/pull from the post-vcs repo, while managing your own repo)

      See those two options in the question on repo tranfers, with this answer for more on submodules.

      这篇关于Git和多个存储库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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