Geo
Geo

Reputation: 96827

How should I switch to trunk after I cloned an entire SVN repository with git-svn?

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 

Upvotes: 0

Views: 1043

Answers (3)

Dmitry Pavlenko
Dmitry Pavlenko

Reputation: 8968

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.

Upvotes: 1

prusswan
prusswan

Reputation: 7101

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.

Upvotes: 2

knittl
knittl

Reputation: 265231

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 …

Upvotes: 1

Related Questions