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

问题描述

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



处理这个问题的最佳方法是什么?只需要为我的文件存储一个存储库,并在另一个文件夹中有posh-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和多个存储库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

  • 08-12 19:35