如何处理具有git-svn和纯粹的git远程控制的git [英] How to deal with a git that has git-svn and pure git remotes

查看:158
本文介绍了如何处理具有git-svn和纯粹的git远程控制的git的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有两个存储库,其中一个仍然是一个 svn ,充当主要位置,另一个是纯粹的 git ,其中是日常工作。我有我的本地克隆使用 git svn克隆svn + ssh:// ... 并添加远程使用 git remote add git @ .. 。



重构其提交和分支后, git 主目录结构被修改,我尝试 git svn dcommit 一堆冲突出现在对 svn 变形的东西中。这就像重新命名和重定位的文件和目录的 丢失了。



我正在阅读的解决方案看起来来自两种情况远程同时进行,甚至可能导致问题。是否有办法告诉 git-svn 策略一样将svn转换为



更新@ 20140821



过了一段时间,我发现它可以为我工作,但我不确定这会是足够的通用的。

在我的情况下,我有两个遥控器具有相同的提交,也就是当我执行 push 在我做一个 dcommit 之前或之后。然后我可以强迫自己始终以git开头,然后继续使用svn。



它看起来像:

  git svn fetch 
git fetch gitremote
git add file1 file2
git commit -m某些描述性但简洁的内容
git push gitremote分支
git svn dcommit

我发现将提交首先发送给svn的唯一方法是,在推送中使用选项 - force ,否则 status 命令包含一条消息:

 #你的分支和'gitremote / branch'已经分开了,
#并且分别有3个和2个不同的提交。

任何尝试合并都会显示 commit中所做的所有更改 code>像新的一样。但是如果git仓库中有其他更改(例如另一个开发人员已经推出了某些内容),那么这个 force 看起来有一个大问题,那么这个组合可能会覆盖这些更改。

$为避免在git远程端重写历史记录(git push),您可以简单地进行合并。在最简单的情况下,您将更改推送到 svn / branch ,并且有一个对应的 git_remote / branch 差异:
$ b $ $ p $ g $ g $ check $ git_remote / branch
# - 我们忽略潜在冲突,假设git diff为空
git merge -s我们的svn / branch
git push git_remote HEAD:branch


I have two repositories, one is still an svn and acts as the main place, and another is pure git where is the daily work. I've my local clone using git svn clone svn+ssh://... and adding a remote using git remote add git@....

After a refactoring with its commits and branches, the git master has the directory structure modified and when I try to git svn dcommit a bunch of conflicts arise in what looks like a rebase to the svn. It's like the mv of files and directories to rename and relocate are lost.

The solutions I'm reading looks that comes from scenarios where both remote are being committed at the same time, and even this can cause issues. Is there a way to tell git-svn to act like strategy is to convert the svn to what git has?

Update @ 20140821

After a while I've found how it can work for me, but I'm not sure this would be enough generic.

In my case I'm having both remotes with the same commits, that is when I do a push just before or after I'll do a dcommit. Then I can force myself to always start by the git and then continue with svn.

It looks like:

git svn fetch
git fetch gitremote
git add file1 file2
git commit -m "something descriptive but concise"
git push gitremote branch
git svn dcommit

The only way I've found sending the commit first to svn, is to use the option --force in the push, because otherwise the statuscommand was including a message:

# Your branch and 'gitremote/branch' have diverged,
# and have 3 and 2 different commits each, respectively.

And any try to merge shows all the changes made in the commit like new. But this force looks to have a big issue if there are other changes in the git repository (for example another developer has already pushed something there), then this force may overwrite those changes.

解决方案

To avoid history rewrite (git push) on the git remote side you could simply do a merge. In the simplest case, where you have pushed your changes to svn/branch and have a corresponding git_remote/branch with no difference:

git checkout git_remote/branch
# -s ours to ignore potential conflicts, assuming git diff is empty
git merge -s ours svn/branch
git push git_remote HEAD:branch  

这篇关于如何处理具有git-svn和纯粹的git远程控制的git的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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