将git-svn分支与git存储库同步 [英] Synchronize git-svn branch with git repository

查看:97
本文介绍了将git-svn分支与git存储库同步的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们有一个使用SVN作为版本控制的客户端.我们必须使用他们的存储库,他们不想为我们创建分支,而只想为其部署创建分支,因此我们无法创建小的提交,而在准备好部署功能时只能创建大的提交.

We have a client that has SVN as version control. We have to work with their repository and they don't want to create branches for us, only the branch they deploy, so we cannot create small commits, only a big one when the feature is ready to be deployed.

我已经阅读了有关git-svn的信息,我认为这几乎是完美的解决方案.但是,有没有一种方法可以将本地创建的分支与外部存储库进行同步?既可以备份又可以与其他人同步.

I've read about git-svn and I think it's almost the perfect solution. But is there a way of synchronizing locally created branches with an external repository? Both to backup and sync with other people.

我的意思是,您拥有SVN信息库.使用Git克隆它并创建一个分支(本地,在SVN存储库中不允许这样做).有没有一种方法可以使该分支指向任何新创建的存储库.就像从该分支创建的另一个存储库一样.

I mean, you have the SVN repository. Clone it with Git and create a branch (locally, not allowed to do in the SVN repo). Is there a way of making that branch point to any newly created repository. Like a different repository created from that branch.

我希望我能解释一下.这可能吗?

I hope I could explain it. Is this possible?

推荐答案

用类似这样的东西克隆了Subversion存储库之后

After you have cloned the subversion repository with something like this

git svn clone -s $SVN_URL proj-clone

您可以添加一个真实的" git远程存储库:

you can add a "real" git remote repository:

cd proj-clone
git remote add team $GIT_URL

您必须选择与通常的 origin 不同的远程名称,因为 git svn 将使用相同的引用(例如 refs/remotes/origin/trunk )作为 git remote 进行跟踪.

You have to choose a different remote name than the usual origin because git svn would use the same refs (e.g. refs/remotes/origin/trunk) for tracking as git remote.

之后,您可以像往常一样将其拉/推到git-remote.

After that you can pull/push as usual to the git-remote.

如果-另一方面-您只想跟踪一个分支,如下所示:

If - on the other hand - you only want to track one branch like this:

git svn clone $SVN_URL/trunk proj-clone

然后 git svn 不使用命名空间 refs/remotes/origin/* ,而是使用 refs/remotes/git-svn .在这种情况下,您可以使用通常的 origin 作为远程名称.

then git svn dos not use the namespace refs/remotes/origin/* but refs/remotes/git-svn. In this case you can use the usual originas the remote name.

在任何情况下:您可以在 git svn clone 期间使用-prefix = 参数进行修改.(请参见文档).

In any case: You can modify this by using the --prefix= parameter during git svn clone. (See the docs).

这篇关于将git-svn分支与git存储库同步的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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