Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Start tracking branches/tags on a git-svn repo that was tracking only trunk

I've started tracking an svn repository with git by cloning only its trunk directory. Now I want to track the other stuff, but I don't want to have to clone it again just to use --stdlayout since it takes a long time to download and I already have most of the code locally. How do I change the repository layout to match svn trunk/branches/tags scheme without having to clone again?

like image 667
agentofuser Avatar asked Oct 17 '09 15:10

agentofuser


People also ask

How do I clone a branch in SVN?

# Clone a repo with standard SVN directory layout (like git clone): git svn clone http://svn.example.com/project --stdlayout --prefix svn/ # Or, if the repo uses a non-standard directory layout: git svn clone http://svn.example.com/project -T tr -b branch -t tag --prefix svn/ # View all branches and tags you have ...

Can I use git and SVN at the same time?

No interaction between them. Just ignore the . git folder for SVN and the . svn folder for Git and you should be fine.

What does git SVN fetch do?

This retrieves all the changes from the SVN repository and applies them on top of your local commits in your current branch. You can also use git svn fetch to retrieve the changes from the SVN repository but without applying them to your local branch.


1 Answers

Old .git/config:

[svn-remote "svn"]
        url = svn://host/project/trunk
        fetch = :refs/remotes/git-svn

New .git/config:

[svn-remote "svn"]
        url = svn://host/project
        fetch = trunk:refs/remotes/git-svn
        branches = branches/*:refs/remotes/*
        tags = tags/*:refs/remotes/tags/*

Now run git svn reset -r1 -p; git svn fetch; git svn rebase.

No, it's not much different from doing a git svn clone anew -- adding branches means that git can see more merges which means the content git is tracking has changed so git-svn must regenerate everything.

like image 103
ephemient Avatar answered Oct 05 '22 10:10

ephemient