简体   繁体   English

简单“从SVN获取所有新提交并将它们放入真正的GIT,到'svn'分支”设置?

[英]Simple “Get all new commits from SVN and put them into a true GIT, to 'svn' branch” setup?

it is my first attempt to make git-svn project. 这是我第一次尝试制作git-svn项目。 I have Debian server with direct access. 我有可直接访问的Debian服务器。

Info: - local SVN is one branch and i won't be doing any local or remote commits 信息: - 本地SVN是一个分支,我不会做任何本地或远程提交

What i want to archive: 我要归档的内容:

  1. Create true GIT local repository. 创建真正的GIT本地存储库。 That's easy :-] 这很容易 :-]

  2. Create SVN local copy(or git-svn repo ? i don't know witch will be better in this case) of http://miranda.googlecode.com/svn/trunk/ (one branch) and then automatically get all changes via some script that detect remote changes and run "svn update" after. http://miranda.googlecode.com/svn/trunk/ (一个分支)创建SVN本地副本(或git-svn repo?我不知道在这种情况下会更好),然后自动获取所有更改一些检测远程更改并在之后运行“svn update”的脚本。

  3. Somehow get all "changes" one by one (files and commit messages) from local SVN repo to local GIT repo and a branch named "Miranda-svn". 以某种方式从本地SVN repo到本地GIT仓库以及名为“Miranda-svn”的分支逐一获取所有“更改”(文件和提交消息)。 So when you look and the commits/log for this specific branch, you will see the same messages as http://code.google.com/p/miranda/source/list has. 因此,当您查看此特定分支的提交/日志时,您将看到与http://code.google.com/p/miranda/source/list相同的消息。

  4. Push "Miranda-svn" branch to the remote github.com account, project name "Test", branch name "Miranda-svn" 将“Miranda-svn”分支推送到远程github.com帐户,项目名称“Test”,分支名称“Miranda-svn”

  5. Merge branch "Miranda-svn" with "master" 合并分支“Miranda-svn”与“主人”

Can somebody help me ? 有人能帮助我吗? Is there some example of such setup ? 有这样设置的一些例子吗?

This is pretty straightforward with Git. Git非常简单。

First "clone" the remote repository with git svn 首先使用git svn“克隆”远程存储库

git svn init --trunk=trunk http://miranda.googlecode.com/svn miranda
cd miranda
git svn fetch
git checkout -b Miranda-svn remotes/trunk 

Note: You may wish to limit the number of revisions fetched by using the -r start:end switch 注意:您可能希望使用-r start:end开关限制获取的修订数

Then add a new remote for github 然后为github添加一个新的遥控器

git remote add origin git@github.com:myuser/test.git

Finally push changes to the github remote 最后将更改推送到github远程

git push origin Miranda-svn

To update Git branch with contents from SVN: 使用SVN中的内容更新Git分支:

git checkout Miranda-svn # Just to be sure that we are on the correct branch
git svn rebase
git push origin Miranda-svn

Merge SVN changes to another Git branch: 将SVN更改合并到另一个Git分支:

git checkout master # Or whatever branch you want
git merge --no-ff Miranda-svn

NB! NB! As SVN has linear history and the "svn" branch will be rebased on every "pull" you do not want to commit anything into Miranda-svn branch with this setup. 由于SVN具有线性历史记录,并且“svn”分支将在每次“拉动”时重新设置,因此您不希望使用此设置向Miranda-svn分支提交任何内容。

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

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