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
Next revision
Previous revision
docs:git:importing_an_svn_repository [2009/10/18 22:16] 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 ======
 +
 +===== 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>
 </code> </code>
-  - create a temporary project directory, and change to it<code> +  - create a project directory, and change to it<code> 
-mkdir myproject_tmp +mkdir myproject.git 
-cd myproject_tmp+cd myproject.git
 </code> </code>
   - initialize an empty git repository<code>   - initialize an empty git repository<code>
-git svn init http://host/path/to/your/svn/repo/ --no-metadata+git svn init -s http://host/path/to/your/svn/repo/project/trunk --no-metadata
 </code> </code>
 +    * note the -s flag sets the default svn structure for /branches /tags /trunk; if this isn't how your repo is set up, you can use the -T -b -t flags
   - set up the user file for mapping<code>   - set up the user file for mapping<code>
 git config svn.authorsfile ~/Desktop/users.txt git config svn.authorsfile ~/Desktop/users.txt
Line 16: Line 19:
 git svn fetch git svn fetch
 </code> </code>
-  - change up one directory, and clone this newly created repository (this cleans up all svn stuff)<code> +  - sync with svn (like running svn update)<code> 
-cd .. +git svn rebase
-git clone myproject_tmp myproject+
 </code> </code>
-  - the myproject_tmp directory can now be removed, and the origin remote<code> +  - use the master branch to push to svn, and create git only branches for your local development 
-rm -Rf myproject_tmp +  - when you have a commit on the master branch ready to push to svn, do this<code> 
-cd myproject +git svn dcommit
-git remote rm origin+
 </code> </code>
 +  - 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
 +
 +===== See Also =====
 +  * [[converting an svn project to git]]
  
 ===== 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.1255925798.txt.gz
  • Last modified: 2009/10/18 22:16
  • by billh