0

I cloned an entire SVN repository ( including all the branches ), using git-svn. The problem is, if I run git branch I don't get anything back. If I run git branch -a I get:

git-svn

What should I do now to start working on SVN's trunk?

EDIT: The repo is organized in the standard layout, but when I pulled I did it like:

git svn clone http://server/repo ( without any other options )

and not like

git svn clone http://server/repo/trunk

My gitconfig looks like this:

[svn-remote "svn"]
    url = svn_url
    fetch = :refs/remotes/git-svn 
Geo
  • 93,257
  • 117
  • 344
  • 520
  • just checking, is the original svn repo organized in the usual standard layout of branches/tags/trunk? normally trunk is mapped to master, so you should have the master branch at the very least – prusswan Nov 02 '11 at 10:09

3 Answers3

2

To avoid a complete reclone you can just update the .git/config file with the following:

[svn-remote "svn"]
url = http://server.org/svn
fetch = trunk:refs/remotes/trunk
branches = branches/*:refs/remotes/*
tags = tags/*:refs/remotes/tags/*

Then delete .git/svn/.metadata and run git svn fetch again

PS: This was inspired from what I found out from Git-SVN with multiple branch locations? when I had to deal with some repo with non-standard layout.

Community
  • 1
  • 1
prusswan
  • 6,853
  • 4
  • 40
  • 61
1

You may clone SVN repostiory with SmartGit. It detects your trunk/branches/tags configuration and configures the layout correctly, so you have not to bother about it.

Dmitry Pavlenko
  • 8,530
  • 3
  • 30
  • 38
1

You have to use the -s (standard layout) switch when cloning:

git svn -s clone http://server/repo

This switch will tell git-svn to create branches and tags from the directories found in ^/branches, respectively ^/tags. ^/trunk will be mapped to git's master branch.

I'm afraid, you will have to re-clone your svn repository …

knittl
  • 246,190
  • 53
  • 318
  • 364
  • I hope you haven't deleted the directory, from my previous experience you just need to delete the metadata files, and do a fetch again. This will avoid the need to re-download all the objects – prusswan Nov 02 '11 at 12:03
  • refer to: http://stackoverflow.com/questions/1638478/git-svn-with-multiple-branch-locations – prusswan Nov 02 '11 at 12:07
  • oh well, but at least you will not repeat this again :) – prusswan Nov 02 '11 at 12:14