简体   繁体   中英

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. I have Debian server with direct access.

Info: - local SVN is one branch and i won't be doing any local or remote commits

What i want to archive:

  1. Create true GIT local repository. 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.

  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". 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.

  4. Push "Miranda-svn" branch to the remote github.com account, project name "Test", branch name "Miranda-svn"

  5. Merge branch "Miranda-svn" with "master"

Can somebody help me ? Is there some example of such setup ?

This is pretty straightforward with Git.

First "clone" the remote repository with 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

Then add a new remote for github

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

Finally push changes to the github remote

git push origin Miranda-svn

To update Git branch with contents from SVN:

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:

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

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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