Note that there are some explanatory texts on larger screens.

plurals
  1. POHow do I list and fetch remote branches after SVN to Git migration?
    primarykey
    data
    text
    <p>I migrated our SVN repository to Git and pushed it to a central repository. We had a fair amount of tags and branches, but somehow we were not able to list and fetch those from a Git client. This was weird, because the tags and branches seemed to be available on the server.</p> <p>With help from a <a href="http://www.jonmaddox.com/2008/03/05/cleanly-migrate-your-subversion-repository-to-a-git-repository/" rel="nofollow noreferrer">Jon Maddox blog post</a>, a <a href="http://www.entropy.ch/blog/Developer/2009/02/28/The-Move-From-Subversion-to-Git.html" rel="nofollow noreferrer">blog post from Marc Liyanage</a> and a <a href="https://stackoverflow.com/questions/79165/how-to-migrate-svn-with-history-to-a-new-git-repository/3972103#3972103">SO answer from Casey</a> I was able to stitch a solution together. Thanks for all the help!</p> <p>Here's what I ended up doing. First I created a file with the svn committers:</p> <pre><code>local$ svn log svn://server/opt/svn/our_app |grep ^r[0-9] | cut -f2 -d\| |sort |uniq | tee ~/users.txt alice bob eve local$ vim ~/users.txt local$ cat ~/users.txt alice = Alice Malice &lt;alice@malice.doh&gt; bob = Bob Hope &lt;bob@hope.doh&gt; eve = Eve Leave &lt;eve@leave.doh&gt; </code></pre> <p>Then I created a git repo from our svn repo:</p> <pre><code>local$ mkdir our_app local$ cd our_app local$ git svn init --stdlayout svn://server/opt/svn/our_app local$ git config svn.authorsfile ~/users.txt local$ git svn fetch local$ git svn create-ignore local$ git commit -m 'added .gitignore, created from svn:ignore' local$ for remote in `git branch -r`; do git checkout -b $remote $remote; done </code></pre> <p>This last step was crucial, since otherwise branches/tags were not available when cloning from a remote repository. Anyway, I pushed this to a new remote repo:</p> <pre><code>local$ ssh server server$ mkdir /opt/git/our_app.git server$ cd /opt/git/our_app.git server$ git --bare init server$ git config core.sharedrepository 1 server$ git config receive.denyNonFastforwards true server$ find objects -type d -exec chmod 02770 {} \; server$ exit local$ git remote add origin ssh://server/opt/git/our_app.git local$ git push --mirror </code></pre> <p>A fresh clone of the remote repository showed that everything was available:</p> <pre><code>local$ git clone ssh://server/opt/git/our_app.git local$ cd our_app local$ git branch -a * master remotes/origin/master remotes/origin/pre-svn-move remotes/origin/tags/mytag-0.1 remotes/origin/tags/mytag-0.2 remotes/origin/trunk remotes/origin/mybranch-1 remotes/origin/mybranch-2 </code></pre> <p>Now a remote branch could be checked out:</p> <pre><code>local$ git checkout -t origin/mybranch-1 local$ git branch master * mybranch-1 </code></pre> <p>Just to re-iterate: this guide includes hints for remote tag and branch availability, mirroring to a remote repo and re-use of values in svn:ignore. I hadn't found all of these in one guide earlier.</p> <p>A final note: <a href="https://stackoverflow.com/questions/4012613/how-do-i-list-and-fetch-remote-branches-after-svn-to-git-migration/4017971#4017971">ebneter's tip about svn2git</a> was also great, since this one actually preserves tags as tags, while git-svn converts them to branches. On the other hand, I couldn't get "git svn create-ignore" to work with svn2git...</p>
    singulars
    1. This table or related slice is empty.
    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.
 

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