Skip to content

Instantly share code, notes, and snippets.

@anandtripathi5
Created March 17, 2018 02:04
Show Gist options
  • Save anandtripathi5/82afd887e287f59ba7014a662f2c1240 to your computer and use it in GitHub Desktop.
Save anandtripathi5/82afd887e287f59ba7014a662f2c1240 to your computer and use it in GitHub Desktop.
Svn to git migration with history

For this, I have used svn2git library with the following procedure:

sudo apt-get install git-core git-svn ruby sudo gem install svn2git svn log --quiet | grep -E "r[0-9]+ \| .+ \|" | cut -d'|' -f2 | sed 's/ //g' | sort | uniq > authors.txt (this command is for mapping the authors)

  • Above step should be performed in the folder that you are going to convert from svn to git.
  • Add one mapping per line in authors.txt like this
anand = Anand Tripathi <email_id>
trip = Tripathi Anand <email_id>
  • Create a folder for a new git repository and execute the command below having the path of authors.txt

svn2git <svn_repo_path> --nobranches --notags --notrunk --no-minimize-url --username <user_name> --verbose --authors <author.txt_path>

  • If no trunk and no tag and branch is present then have to execute the above command else if root is trunk then mention rootistrunk or trunk is present then --trunk <trunk_name>

git remote add origin <git_repo_path> git push --all origin git push --tags origin

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