当必须使用Git和Subversion时如何处理Git-svn [英] How to deal with Git-svn when have to use both Git and Subversion

查看:96
本文介绍了当必须使用Git和Subversion时如何处理Git-svn的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

更多详情,为什么我在家里尝试做纯Git的原因是,我的公司会喜欢迁移到Git,但管理者不会喜欢做出改变,因为开发人员在我们自己的存储库中没有Git知识。所以,我试图做的是,我尝试让每个人都使用Pure git,而在这个学习阶段有人可以合并到Subversion。因此,在任何紧急情况下,他们仍然可以使用Subversion。因此,在每个人都熟悉Git之前,我无法将存储库转移到使用纯粹的Git。因此,它将在Subversion和Git上进行更新。 (现在主版本库是Subversion)。所以,我试着让Git能够在dmpmit与Subversion同步存储库期间顺利运行。



[问题]



我在使用Subversion作为存储库的组织中,因此将其转储为我的个人Git(并计划在未来将Git替换为Subversion)



现在,我拥有使用 Git Subversion(主要来源)的存储库。当我必须同时使用git和subversion时,我遇到了处理 git svn rebase 的问题。



我的工作流如下

>

在办公室



  1. 存储库具有Git-svn接口
  2. 我总是通过 svn dcommit 从此处将代码提交给Subversion。

  3. 我在Bitbucket中推送到远程git存储库


在家



  1. 我从Bitbucket中克隆存储库
  2. 使用并提交Bitbucket


现在,回到OFfice



  1. git pull

  2. git svn rebase

  3. git svn dcommit

  4. git push


在步骤4我有一个问题,我已经重新戴上了我的胸罩nch



当我回家时,问题现在出现



回家后,我不能使用'git fetch',因为该分支已经重新发行。所以,我必须再次使用 git branch -D ..... git checkout 移除分支。



<因此,我寻找可以同时使用Git存储库和Subversion的方式,并且在使用 git svn dcommit 完成操作后, 。



注意。我不会在家使用任何 git-svn 。尝试仅使用Git。

解决方案

使用Git进行版本控制一书。

不使用本地主分支,而必须检出远程分支

  git checkout remote / master(Detach HEAD)
git merge --no-ff master(merge the local master)
git svn dcommit
git push origin(update to git仓库)

这个模型适用于一个将合并到Subversion存储库的人,而另一个人则是纯粹的Git或纯粹的Subversion。通过这种方式,Git用户可以在不合并问题的情况下使用Git。


[Update]

For more details, The reason that why I try to do pure Git at home is that, my company would like to move to Git but manager won't like to make change because developer don't have knowledge with Git on our own repository. So, what I try to do is, I try to make everyone use Pure git while someone can merge back to Subversion during this learning phase. So, in any emergency case, they can still using Subversion.

So, before everyone familar with Git, I cannot transfer repository to use pure Git. So, it will have both update on Subversion and Git. (and Main repository right now is Subversion). So, I try to make the way that Git can working smoothly during I have sync repository by dcommit back to Subversion.

[Question]

I am in the organization which use Subversion as repository, so I dump it as my personal Git (and plan to use replace Subversion with Git in the future)

Now, I have repository that use both Git and Subversion (Main Source). I have a problem to deal with git svn rebase when I have to use both git and subversion.

My Workflow is like below

At Office

  1. The Repository have Git-svn interface
  2. I always commit the code to Subversion with git svn dcommit from here.
  3. I push to my remote git repository at Bitbucket

At Home

  1. I clone the repository from Bitbucket
  2. Working with and commit to Bitbucket

Now, Back to OFfice

  1. git pull
  2. git svn rebase
  3. git svn dcommit
  4. git push

In step 4. I have a problem that I already rebased my branch

Problem now here, when I am back home

When I come back home, I cannot use 'git fetch' because the branch is already rebased. So, I have to remove branch with git branch -D ..... and then git checkout again.

So, I look for the way that we can concurrent use both Git repository and Subversion and do going well with Git after done operation with git svn rebase or git svn dcommit.

Note. I won't prefer to use any git-svn at home. Try to move forward to use only Git.

解决方案

Found the solution from Version Control with Git book. Page 295.

Instead of use local - master branch, have to checkout remote branch

git checkout remote/master (Detach HEAD)
git merge --no-ff master (merge the local master)
git svn dcommit
git push origin (update to git Repository)

This model is for one person who will merge back to Subversion repository while the other work on pure Git OR pure Subversion. With this way, The Git Users can use Git without Merging problem.

这篇关于当必须使用Git和Subversion时如何处理Git-svn的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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