Skip to content

Instantly share code, notes, and snippets.

@srikarn
Created May 19, 2017 15:47
Show Gist options
  • Save srikarn/e7c3bcd72c2f5f054dc34adb9fafcb17 to your computer and use it in GitHub Desktop.
Save srikarn/e7c3bcd72c2f5f054dc34adb9fafcb17 to your computer and use it in GitHub Desktop.
Import an SVN Project in to git
* Clone the SVN Repo that you would like to convert to git
* SVN commit only has username associated with it, whereas Git commit is more richer, it contains user names and email addresses
* You can associate all the commits in git history with this info using an authors file
* Create the authors file as follows
svn log -q | awk -F '|' '/^r/ {sub("^ ", "", $2); sub(" $", "", $2); print $2" = "$2" <"$2">"}' | sort -u > authors-transform.txt
* Install the svn2git as $ sudo gem install svn2git
* svn2git https://svn-idis.ea.vanderbilt.edu/idev/amcom --authors authors-transform.txt --username <username>
* that will convert your svn project to git, if there any error's regarding gc
* Since that is the last command ran by the utility, you can run git gc manually
* Create your remote repository and add it to your local
git remote add origin https://[email protected]/repo.git
* git push origin master
* to push any tags you have git push origin --tags
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment