On Thursday, December 20, 2012 5:35:56 AM UTC+1, Daniel Pomerantz wrote:
> I have what is probably a silly question.
They are not silly :)
> Short background: I hate SVN and finally got my boss to agree to move to
> git, if I can make him happy with it. I started looking at migrating today
> and ran the following command for our relatively small repo. It should be
> noted that I have the standard /trunk/branches/tags directories from the
> git svn clone <svn_url> --authors-file=users.txt --no-metadata -s
> The repo itself looks to have been created with all revisions, but the
> tags and branches are missing. When I CD into the directory and type "git
> tag -l" it comes up empty, and when I type in "git show-branch" I get one
> entry, which isn't really a branch at all. Just a revision where the
> comment had b as the first letter.
Any reason why you are not using the --stdlayout argument? This is key for
converting a standard layout SVN (trunk/branches/tags) into branches in Git.
> So lots of questions: Why do some of the branches and tags show up with
> an @pegrev and not others? Maybe it's something I don't need to worry
> about, but what is it?
I think they're kind of timestamps for when something was branched out in
SVN. You can just ignore them, and delete them later on when you're done
with everything else.
> Since these are showing up as remote, does that mean that they are in the
> svn repo only?
They're also in your Git repo. Remote branches are always "in" your own
repository as well. You'll fix this when you push all branches into a bare
Git repository as I explain further down.
> Big question I guess is what am I doing wrong? How do I import my svn
> repo into git, complete with branches and tags?
Note that git-svn doesn't create Git tags from SVN tags. SVN tags are
physically equal to branches, so that's why they are converted to Git
branches. This however, is easy to fix. See the "Changing tagging commits
to tags" section in this page:
As a bonus question, how do I do that into a bare git repo? The best
> method I've found so far is to clone it "local" and then "git clone --bare
> <Git_Repo_Name> <git_repo_name>.git" Will that even work? Is it the best
> way for a bare repo migrated from svn?
After you have created a git-svn clone. you can create an empty bare repo,
and push all branches from your git-svn clone into the bare repository.
The gist of it is:
First do the git-svn clone (you've probably already done this):
git svn clone -s foo-fetching
Next up, initialize the bare repository
git init --bare ~/git-repos/foo.git
In fetch repo: add the remote 'bare':
git remote add bare ~/git-repos/foo.git
Now edit foo-fetching/.git/config:
#Set fetch to do remotes instead of heads:
fetch = +refs/remotes/*:refs/remotes/bare/*
#Add a push configuration, push all remotes to heads:
push = refs/remotes/*:refs/heads/*
Now, back on the command line, push all branches from git-svn clone into
the bare repository:
git push bare
After this, you can start cleaning up, put the bare repository in some
shared folder where others can access it, and profit.
I've shown all this, plus a few other tricks in this