我正在尝试整合两个svn仓库。一个是另一个的分叉。但它不完全是一个叉,所以我找不到一个共同点。
我已经在一个本地的git-svn仓库中克隆了两个仓库,每个仓库在一个分支中,我已经集成了两个仓库,但我知道我需要将更改推送到一个原始仓库。我试图找出最好的工作流程来上传维护历史记录的更改。我认为应该是这样的:
# 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
我找不到一个更好的解释,但我认为git svn dcommit使用上次提交的git-svn-id来确定要推送的url,所以我想在某种程度上我应该重写历史,但我不知道如何。
另外,如果有人能提供一种方法,使测试之前真正上传的变化将是伟大的。
经过一番研究,我发现了如何根据这篇文章重写历史。要修改git-svn-id,使用:
git filter-branch --msg-filter 'sed "s/git-svn-id:.*//g"' myBranch