Things look good, but I have a few questions/comments.  What I've done so 
far since reading the responses and links:

I removed "empty" commits with this command:

git filter-branch --prune-empty --tag-name-filter cat -- --all

I then created a shell script with the following and ran it to create my 

git for-each-ref --format="%(refname)" refs/remotes/tags/ |
while read tag; do
    GIT_COMMITTER_DATE="$(git log -1 --pretty=format:"%ad" "$tag")" \
    GIT_COMMITTER_EMAIL="$(git log -1 --pretty=format:"%ce" "$tag")" \
    GIT_COMMITTER_NAME="$(git log -1 --pretty=format:"%cn" "$tag")" \
    git tag -m "$(git for-each-ref --format="%(contents)" "$tag")" \
        ${tag#refs/remotes/tags/} "$tag"

I then created a bare repository, connected to it as a remote, and made the 
following config changes for it in .git\config

    fetch = +refs/remotes/*:refs/remotes/bare/*
    push = refs/remotes/*:refs/heads/*

Finally, ran the following command to get everything in the bare repository:

git push barerepo

>From there I can cd into the bare repo and see all of my branches and 
tags.  Looks good, but a few questions/comments:

The branches still aren't visible "locally" on the SVN (fetched) repo.  It 
doesn't matter too much since its only purpose was to create the bare repo, 
but it's odd.  Is this normal?

I created the bare repo in two ways, just tp play around.

In one way I created a real bare repo with 

git init --bare bare.git

and for the other I cloned the svn repo with 

git clone --bare fetched cloned.git

Both of them allowed me to set a remote and push to it.  Is there a 
functional difference?  Any reason to use one over the other?

Final question (for now):  the "fetched" repo weighs in at about 2 GB, and 
I made a couple of backups, which took about 4 minutes each.  The "cloned" 
repo that I created and then pushed is about 650 MB, and took under a 
minute to push.  The "pushed" repo is only about 475 MB, and seemed to take 
longer to create than the "cloned" repo.  Does this make sense?  Why are 
the two repos so much smaller than the fetched svn repo?  Why are they not 
the same size as each other?  Is it because of compression used in the bare 
repos?  The lack of a working copy?  Does the cloned one have more 
uncompressed files because it was cloned?  Just trying to figure things 
out, so any information would be appreciated.



On Thursday, December 20, 2012 2:22:50 AM UTC-6, Thomas Ferris Nicolaisen 
> 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 
>> svn_url:
>> git svn clone <svn_url> --authors-file=users.txt --no-metadata -s 
>> <Git_Repo_Name>
>> 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):
> cd  ~/git-repos/
> git svn clone -s foo-fetching
> Next up, initialize the bare repository
> cd ~/git-repos
> git init --bare ~/git-repos/foo.git 
> In fetch repo: add the remote 'bare':
> cd foo-fetching
> 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 presentation: 


Reply via email to