Skip to content

JamisonWhite/svn_trunk_to_git_subtree

Repository files navigation

svn_trunk_to_git_subtree

Migrate multiple SVN repo trunks to a single Git repo using subtrees.

These bash scripts are intended to migrate multiple SVN trunk folders into a single Git repo. They support one-way creation and update operations. Because SVN branch and tag folders are ignored these scripts can be used on SVN servers that contain multiple projects where each project contains its own trunk, branch, and tag folders. I needed this to migrate 10 years of SVN code to TFS and did not want the branch history.

##Environment

I used Git-Bash on a Windows 8 machine to pull from a VisualSVN server to a Microsoft TFS. No other configurations were tested.

##Inputs By default the scripts will create a working folder in the current folder. This folder is ignored in our .gitignore file. All SVN repos will be impored to a svn_import branch.

###working folder Optional command line argument for all the scripts. If not specified then the current folder will be used.

###svn.map Required tab separated file containing the target folder name and the SVN trunk URL.

###authors.txt Required git authors file formatted as: svn_author_username = git_author_name <git_email>

###.gitignore Optional .gitignore file to be copied to the target repo.

##Scripts Each script has an example using the included sample working folder. The working folder has the inputs to migrate the Apache log4j, log4net, and log4php SVN trunks into a single Git repo. (Do not execute the samples. The current sample SVN repos are huge and require hours to process.)

###01_init_target_repo.sh [working folder]

  • Create the target folder
  • Initialize the Git repo

Example:

$ 01_init_target_repo.sh ~/Documents/GitHub/svn_trunk_to_git_subtree/sample_working

###02_svn_to_staging.sh [working folder]

  • Use "git svn clone" to create a new Git repo for each SVN trunk. (very slow)
  • Use "git svn rebase" to update an already created Git repo.

Example:

$ 02_svn_to_staging.sh ~/Documents/GitHub/svn_trunk_to_git_subtree/sample_working

###03_staging_to_target.sh [working folder]

  • Use "git subtree add" to add the folder to the target Git repo.
  • Use "git subtree pull" to update an already created Git repo folder.

Example:

$ 03_staging_to_target.sh ~/Documents/GitHub/svn_trunk_to_git_subtree/sample_working

##Future

  • Find smaller, public SVN repos to use for the examples
  • Test in different environments
  • Add push to Git remote
  • Add two-way updates

About

Migrate multiple SVN repo trunks to a single Git repo using subtrees.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages