Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Create a users file (i.e. <code>users.txt</code>) for mapping SVN users to Git:</p> <pre><code>user1 = First Last Name &lt;email@address.com&gt; user2 = First Last Name &lt;email@address.com&gt; ... </code></pre> <p>You can use this one-liner to build a template from your existing SVN repository:</p> <pre><code>svn log -q | awk -F '|' '/^r/ {sub("^ ", "", $2); sub(" $", "", $2); print $2" = "$2" &lt;"$2"&gt;"}' | sort -u &gt; users.txt </code></pre> <p>SVN will stop if it finds a missing SVN user not in the file. But after that you can update the file and pick-up where you left off.</p> <p>Now pull the SVN data from the repository:</p> <pre><code>git svn clone --stdlayout --no-metadata --authors-file=users.txt svn://hostname/path dest_dir-tmp </code></pre> <p>This command will create a new Git repository in <code>dest_dir-tmp</code> and start pulling the SVN repository. Note that the "--stdlayout" flag implies you have the common "trunk/, branches/, tags/" SVN layout. If your layout differs, become familiar with <code>--tags</code>, <code>--branches</code>, <code>--trunk</code> options (in general <code>git svn help</code>).</p> <p>All common protocols are allowed: <code>svn://</code>, <code>http://</code>, <code>https://</code>. The URL should target the base repository, something like <a href="http://svn.mycompany.com/myrepo/repository" rel="noreferrer">http://svn.mycompany.com/myrepo/repository</a>. That must <strong>not</strong> include <code>/trunk</code>, <code>/tag</code> or <code>/branches</code>.</p> <p>Note that after executing this command it very often looks like the operation is "hanging/freezed", and it's quite normal that it can be stuck for a long time after initializing the new repository. Eventually you will then see log messages which indicates that it's migrating.</p> <p>Also note that if you omit the <code>--no-metadata</code> flag, Git will append information about the corresponding SVN revision to the commit message (i.e. <code>git-svn-id: svn://svn.mycompany.com/myrepo/&lt;branchname/trunk&gt;@&lt;RevisionNumber&gt; &lt;Repository UUID&gt;</code>)</p> <p>If a user name is not found, update your <code>users.txt</code> file then:</p> <pre><code>cd dest_dir-tmp git svn fetch </code></pre> <p>You might have to repeat that last command several times, if you have a large project, until all of the Subversion commits have been fetched:</p> <pre><code>git svn fetch </code></pre> <p>When completed, Git will checkout the SVN <code>trunk</code> into a new branch. Any other branches are setup as remotes. You can view the other SVN branches with:</p> <pre><code>git branch -r </code></pre> <p>If you want to keep other remote branches in your repository, you want to create a local branch for each one manually. (Skip trunk/master.) If you don't do this, the branches won't get cloned in the final step.</p> <pre><code>git checkout -b local_branch remote_branch # It's OK if local_branch and remote_branch are the same name </code></pre> <p>Tags are imported as branches. You have to create a local branch, make a tag and delete the branch to have them as tags in Git. To do it with tag "v1":</p> <pre><code>git checkout -b tag_v1 remotes/tags/v1 git checkout master git tag v1 tag_v1 git branch -D tag_v1 </code></pre> <p>Clone your GIT-SVN repository into a clean Git repository:</p> <pre><code>git clone dest_dir-tmp dest_dir rm -rf dest_dir-tmp cd dest_dir </code></pre> <p>The local branches that you created earlier from remote branches will only have been copied as remote branches into the new cloned repository. (Skip trunk/master.) For each branch you want to keep:</p> <pre><code>git checkout -b local_branch origin/remote_branch </code></pre> <p>Finally, remove the remote from your clean Git repository that points to the now deleted temporary repository:</p> <pre><code>git remote rm origin </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload