Last active
May 26, 2016 19:45
-
-
Save chenrui333/3f29d289d56fdab861fc to your computer and use it in GitHub Desktop.
Migrate SVN repo to Git
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Tool: svn2git | |
Steps | |
1. extract the SVN repo user list | |
svn log {repo} --quiet | grep "^r" | awk '{print $3}' | sort | uniq | |
e.g. | |
rui.chen | |
2. put the authors info to authors.txt, add the email mapping | |
e.g. | |
rui.chen = Rui Chen <[email protected]> | |
3. svn2git to migrate everything (assuming std layout) | |
svn2git {repo} --authors {path-to-authors-file}/authors.txt --no-minimize-url | |
4. Add remote origin, and then push --all | |
git remote add origin {origin.url} | |
git push origin --all (it will push all the branches) (or git push origin master, which only pushes master branch) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Tool: svn2git | |
Steps | |
1. git reset --hard {commit_id} (commit_id is the last common parent commit) | |
2. svn2git --rebase (merge the commits from svn trunk to local git master) | |
3. git checkout -b rebase-svn (create rebase-svn branch) | |
4. git push origin rebase-svn (push to create new branch) | |
5. PR and merge in Github | |
NOTE | |
1. NO pull origin master, since it will create dup commits when create rebase branch and PR to master | |
2. if local git not clean, stash first, and pop the stash after everything (every code merge) is done | |
this will help the repo commit history is more linear |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
About
--no-minimize-url
SO post