Note that there are some explanatory texts on larger screens.

plurals
  1. POConverting svn to git, how to get the branches not to be just remote in the svn repo?
    text
    copied!<p>I'm quite new to git and I'm trying to move a svn repository to git. I followed the guide below so now I have a git repo on my server<br> <a href="http://pauldowman.com/2008/07/26/how-to-convert-from-subversion-to-git/" rel="nofollow noreferrer">http://pauldowman.com/2008/07/26/how-to-convert-from-subversion-to-git/</a></p> <p>So, if I do "git branch" git replies "* master" and if I do "git branch -r" i get a list of all the branches in the svn repository.</p> <p>My last svn-checkins have been in one of the branches, but when I did the "git svn clone"-stuff my commits in that branch (they have not been merged into the trunk yet) are visible in my (git) master branch. What am I missing here?</p> <p>Also, if I on my development machine do "git clone " I get the files alright. But if I do "git branch -r" I can only see the master branch and not the remote branches". </p> <p>Since we're getting rid of the svn-repo all together I would like to have all the svn branches in the git-repo so that they can be accessed from the developer clients.</p> <p>Again, I'm not a total git newbie but not far from it. So if there is something fundamental I'm missing here please tell me.</p> <p><strong>Update</strong><br> After doing some RTFM (man git-svn) I solved the first problem with branch stuff present in the master branch </p> <blockquote> <p>reset --hard remotes/trunk</p> </blockquote> <p>Now the trunk and the master branch are the same. Now, next is to figure out how to get the branches from the development clients.</p> <p><strong>Update 2</strong><br> I got it working by combining the url above and the url that Scott pointed to. So, from the beginning.</p> <p>I first created an empty repository on the server, they are kept in /usr/local/git-repos on our server: </p> <pre><code>server&gt; cd /usr/local/git-repos server&gt; mkdir my_project.git server&gt; cd my_project.git server&gt; git init </code></pre> <p>Then i cloned the svn-repository to my dev-machine (note, that on our svn server the "branches" dir is called "branch" <strong>witout</strong> the 's'): </p> <pre><code>dev&gt; git svn clone http://&lt;svn.server&gt;/my_project --no-metadata -A authors.txt -t tags -b branch -T trunk my_project </code></pre> <p>Then some clean-up to get the tags and branches in order:</p> <pre><code>dev&gt; cp -Rf .git/refs/remotes/tags/* .git/refs/tags/ dev&gt; rm -Rf .git/refs/remotes/tags dev&gt; cp -Rf .git/refs/remotes/* .git/refs/heads/ dev&gt; rm -Rf .git/refs/remotes </code></pre> <p>Now add my server as a remote repository:</p> <pre><code>dev&gt; git remote add origin jorgen@&lt;our_server&gt;:/usr/local/git-repos/my_project.git </code></pre> <p>Finally, push all branches and tags up to the server:</p> <pre><code>dev&gt; git push origin --all </code></pre> <p>Phew, now there you have it, now I can get rid of that svn-repo.</p> <p><strong>Update 3</strong><br> Checkout <a href="https://stackoverflow.com/questions/1584675/converting-svn-to-git-how-to-get-the-branches-not-to-be-just-remote-in-the-svn-r/1592090#1592090">ebneters post</a> below for an easier way of doing it...</p>
 

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