ApproachAI

corperate with svn using git

Published · Updated

migration prepare

ref: https://www.atlassian.com/git/tutorials/migrating-prepare

  • download migration script

  • mkdir ~/GitMigration

  • Extract the author information:

cd ~/GitMigration
java -jar ~/svn-migration-scripts.jar authors <svn-repo> > authors.txt

if the number of authors is small,you can create the authors manually.

convert

ref: https://www.atlassian.com/git/tutorials/migrating-convert

git svn clone --trunk=/STORAGE_PRODUCT --no-metadata --authors-file=authors.txt --username=baojianguo http://192.168.88.85/svn/ objdev1
java -Dfile.encoding=utf-8 -jar ~/svn-migration-scripts.jar clean-git
java -Dfile.encoding=utf-8 -jar ~/svn-migration-scripts.jar clean-git --force

synchronzie with svn repo using git

ref :https://www.atlassian.com/git/tutorials/migrating-synchronize when svn add author,we should change the authors.txt file!

git svn fetch
java -Dfile.encoding=utf-8 -jar ~/svn-migration-scripts.jar sync-rebase
java -Dfile.encoding=utf-8 -jar ~/svn-migration-scripts.jar clean-git --force

create git remote repo

omit ## routine workflow

git fetch --all; # fetch from the git repo
git reset --hard origin/master; 
git log; 
git status; 
git log; 
git svn fetch; # from the svn repo 
java -Dfile.encoding=utf-8 -jar ../../svn-migration-scripts.jar sync-rebase;
git mergetool; # config meld as mergetool
git rebase --continue;
git log;
git push -f origin master; #then test on git code
git fetch --all;
git reset --hard origin/master;
git svn fetch;
java -Dfile.encoding=utf-8 -jar ../../svn-migration-scripts.jar sync-rebase;
git svn dcommit;
git push -f origin master;

Back to all articles