简体   繁体   English

将git-svn本地仓库推送到另一个已经存在的svn远程仓库

[英]Push a git-svn local repo to a different svn remote repo that already exists

I'm trying to integrate two svn repos. 我正在尝试集成两个svn仓库。 One is a kind of fork of the other. 一个是另一种的叉子。 But it's not exactly a fork so i can't find a common point. 但这不完全是一个叉子,所以我找不到一个共同点。

I've cloned both repos in one local git-svn repo, each repo in one branch, and i have already integrated both repos but know i need to push the changes to one of the original repos. 我已经将两个存储库克隆到一个本地git-svn存储库中,每个存储库都在一个分支中,并且我已经集成了两个存储库,但是知道我需要将更改推送到原始存储库之一。 I trying to figure the best workflow for upload the changes maintaining the history. 我试图找到最好的工作流,以上传更改并保存历史记录。 I think that it should be something like this: 我认为应该是这样的:

# Move the trunk of the remote repo to a branch
$ svn move svn+ssh://host.example.com/repos/project/trunk svn+ssh://host.example.com/repos/project/branches/NAME_OF_BRANCH -m "Creating a branch of project"

# Make a commit that explains the change that is going to happen

# Change to the branch that tracks the remote repo, and fetch the changes
$ git checkout myBranch
$ git svn rebase

# The folder should be empty at this point

# Upload the local changes to the trunk of the remote repo
$ git merge integrationBranch

# ¿rewrite the history?

# Upload it
$ git svn dcommit

I can't find a better explanation but i think that git svn dcommit uses git-svn-id of the last commit to figure which is the url to push, so i guess that in some point i should rewrite the history, but i don't know how. 我找不到更好的解释,但我认为git svn dcommit使用上一次提交的git-svn-id来确定要推送的网址,因此我想在某个时候我应该重写历史记录,但是我不知道不知道如何

Also if anyone can provide a way to make a test before really upload the changes will be great. 同样,如果任何人都可以提供一种在真正上传之前进行测试的方法,那么这些更改将很棒。

After some research i found how to rewrite the history based on this post . 经过一番研究,我发现了如何根据这篇文章改写历史。 To change the git-svn-id i use: 要更改git-svn-id我使用:

git filter-branch --msg-filter  'sed "s/git-svn-id:.*//g"' myBranch

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

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