Migrate SVN to Git: Difference between revisions

From Alpine Linux
(Category:Git)
m (Fix code without <code>, fix shouldnt => shouldn't.)
 
(One intermediate revision by one other user not shown)
Line 1: Line 1:
This document describes how to migrate an SVN repository to git. Most repositories are already migrated so this is mostly for historical reference.
{{obsolete|This document describes how to migrate an SVN repository to git. This is for historical reference.}}




Line 7: Line 7:
{{Cmd|mkdir proj-tmp}}
{{Cmd|mkdir proj-tmp}}


Init the git repository. If your svn repo does not have the standard trunk branches and tags dirs you shouldnt use the --stdlayout. You can also use -T trunk -b branches -t tags.  
Init the git repository. If your svn repo does not have the standard trunk branches and tags dirs you shouldn't use the <code>--stdlayout</code>. You can also use <code>-T trunk -b branches -t tags</code>.  


{{Cmd|cd proj-tmp
{{Cmd|cd proj-tmp
git svn init svn://svn.alpinelinux.org/proj --stdlayout}}
git svn init <nowiki>svn://svn.alpinelinux.org/proj</nowiki> --stdlayout}}


== Create user mapping ==
== Create user mapping ==

Latest revision as of 10:46, 17 February 2024

This material is obsolete ...

This document describes how to migrate an SVN repository to git. This is for historical reference. (Discuss)


Init git repository

Create a temp work area.

mkdir proj-tmp

Init the git repository. If your svn repo does not have the standard trunk branches and tags dirs you shouldn't use the --stdlayout. You can also use -T trunk -b branches -t tags.

cd proj-tmp git svn init svn://svn.alpinelinux.org/proj --stdlayout

Create user mapping

Start with creating a users.txt file where the svn users are mapped to an email address for git.

echo "ncopa = Natanael Copa <ncopa@example.com>" > users.txt

Connect the user mapping

Connect the users.txt to the empty git repository so users are remapped.

git config svn.authorsfile ../users.txt

Fetch SVN repository

This might take some time.

git fetch

Upload the Git repository

Now we can create a bare repository and upload it to dev.alpinelinux.org/gitroot.

cd .. git clone --bare proj-tmp proj.git scp -r proj.git dev.alpinelinux.org:/~