docs:git:importing_an_svn_repository

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
docs:git:importing_an_svn_repository [2010/07/07 16:05] billhdocs:git:importing_an_svn_repository [2010/09/20 10:09] (current) billh
Line 1: Line 1:
 ====== importing an svn repository ====== ====== importing an svn repository ======
  
-===== Example 1: using git while keeping an svn repo intact =====+===== using git while keeping an svn repo intact =====
   - create a text file somewhere (~/Desktop/users.txt) to map the svn users to git users<code>   - create a text file somewhere (~/Desktop/users.txt) to map the svn users to git users<code>
 jdoe = John Doe <jdoe@example.com> jdoe = John Doe <jdoe@example.com>
Line 28: Line 28:
   - since it takes so long to pull full svn history into a git repo, you may want to do this once and then set up a git repo that others can clone, if other users want to use git on a large project   - since it takes so long to pull full svn history into a git repo, you may want to do this once and then set up a git repo that others can clone, if other users want to use git on a large project
  
-===== Example 2: converting a project from svn to git ===== +===== See Also ===== 
-To get in the right frame of mind, don't think of exporting your entire svn repository, but rather export project by project.  Export the trunk of your projects and forget about the branches.  If you need data from the branches, merge it first. +  * [[converting an svn project to git]]
- +
-  - create a text file somewhere (~/Desktop/users.txt) to map the svn users to git users<code> +
-jdoe = John Doe <jdoe@example.com> +
-</code> +
-  - create a temporary project directory, and change to it<code> +
-mkdir myproject_tmp +
-cd myproject_tmp +
-</code> +
-  - initialize an empty git repository<code> +
-git svn init http://host/path/to/your/svn/repo/project/trunk --no-metadata +
-</code> +
-    * :!: for some reason I've recently had trouble starting this process with git svn init, so I've been doing git svn clone instead.  It looks like this:<code> +
-git svn clone file:///cygdrive/h/svn/project/trunk myproject_tmp --no-metadata +
-</code> +
-  - set up the user file for mapping<code> +
-git config svn.authorsfile ~/Desktop/users.txt +
-</code> +
-  - import the svn repository<code> +
-git svn fetch +
-</code> +
-  - change up one directory, and clone this newly created repository (this cleans up all svn stuff)<code> +
-cd .. +
-git clone myproject_tmp myproject +
-</code> +
-  - the myproject_tmp directory can now be removed, and the origin remote<code> +
-rm -Rf myproject_tmp +
-cd myproject +
-git remote rm origin +
-</code> +
-  - if you want to push this out to a shared repo, you can do it like this<code> +
-cd /path/to/shared/dir +
-mkdir project.git +
-cd project.git +
-git init --bare --shared +
-cd /path/to/myproject +
-git push /path/to/shared/dir/myproject.git refs/heads/master +
-(you can push other refs if you want at this point, if they should be public) +
- +
-(then I usually git clone from this shared repo for good measure to make sure it all works; your merge paths will work by default too) +
-</code> +
-  - you should also consider that although svn allows empty directories as part of the repo, git does not; we usually fix this by adding empty files named .emptydir in any directory that needs it+
  
 ===== External Links ===== ===== External Links =====
   * http://www.simplisticcomplexity.com/2008/03/05/cleanly-migrate-your-subversion-repository-to-a-git-repository/   * http://www.simplisticcomplexity.com/2008/03/05/cleanly-migrate-your-subversion-repository-to-a-git-repository/
  • docs/git/importing_an_svn_repository.1278540325.txt.gz
  • Last modified: 2010/07/07 16:05
  • by billh