简体   繁体   English

合并/修补不同git仓库之间的更改的最佳方法

[英]Best way to merge/patch changes between different git repos

I've been unable to find an adequate solution to this problem, so any help would be appreciated. 我一直无法找到适当的解决方案来解决此问题,因此将不胜感激。 Here is the setup: 这是设置:

  1. We have an SVN repo. 我们有一个SVN回购。 That repo is also mirrored to a git repo git_svn_mirror . git_svn_mirror也被镜像到git repo git_svn_mirror
  2. A branch svn_branch was created in the SVN repo. 在SVN svn_branch中创建了一个分支svn_branch
  3. Work was done in svn_branch , including merging up from trunk several times. svn_branch中完成了svn_branch ,包括从主干中合并了几次。
  4. A new git repo git_from_svn_branch was created from svn_branch . 一个新的git回购git_from_svn_branch从创建svn_branch
  5. Work was done in git_from_svn_branch . 工作在git_from_svn_branch中完成。
  6. We now need to merge HEAD of svn_trunk into git_from_svn_branch . 现在,我们需要将svn_trunk HEAD合并到git_from_svn_branch

Diagram: 图:

[git_svn_mirror] [SVN]                [git_from_svn_branch]
      |  <-mirror  |
      |  <-mirror  |
      |  <-mirror  |-\                        \
      |  <-mirror  | |                        |
      |  <-mirror  |-|                        |
      |  <-mirror  | |  --> (move to git) --> | (kept branch history only)
      |  <-mirror  |                          |
      |  <-mirror  |                          |
      |  <-mirror  |                          |
      |  <-mirror  |                        HEAD    <----
      |  <-mirror  |                                    |
    HEAD         HEAD                                   |
                                                        |
     ^            ^                                     |
     |____________|__ how do we get one of these, into  |__ this (or vice-versa)

Ignoring the issues that caused us to arrive at this situation ("why was a 2nd git repo created", etc) what is the best solution to the problem? 忽略导致我们遇到这种情况的问题(“为什么创建第二个git repo”等),什么是解决问题的最佳方法?

git remote add git-from-svn-mirror its://repo/url
git fetch git-from-svn-mirror

git merge git-from-svn-mirror/master

should do it. 应该这样做。

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

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