Skip to content

Instantly share code, notes, and snippets.

@chenrui333
Last active May 26, 2016 19:45
Show Gist options
  • Save chenrui333/3f29d289d56fdab861fc to your computer and use it in GitHub Desktop.
Save chenrui333/3f29d289d56fdab861fc to your computer and use it in GitHub Desktop.
Migrate SVN repo to Git
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)
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
@chenrui333
Copy link
Author

About --no-minimize-url
SO post

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment