[bt-devel] git help

Greg Hellings greg.hellings at gmail.com
Thu Aug 5 21:35:22 MST 2010


Another round with #git and we have it working.  Observe the final
command sequence:

Initialize bare repo:
$ cd /home/sites/thehellings.com/bibletime
$ mkdir bibletime.git
$ cd bibletime.git
$ git init --bare
$ git symbolic-ref HEAD refs/heads/trunk

Pull BibleTime
$ cd ~/
$ git svn clone https://bibletime.svn.sf.net/svnroot/bibletime
--ignore-paths="^trunk/(bibletime2|sandbox|website|website-2.0)"
(the above command took between 50 and 70 minutes, depending on
latency - not bandwidth)
$ git remote add bare /home/sites/thehellings.com/bibletime/bibletime.git
$ git config --unset remote.bare.fetch
$ git config remote.bare.push "refs/remotes/*:refs/heads/*"
Convert git branches that were originally SVN tags back into git tags
$ git branch -r | grep tags | sed -e 's/.*\///' | xargs -I % git tag
-a -m\"%\" % tags/%
Remove the fake tag/branches from the following
$ git branch -r | grep tags | sed -e 's/.*\///' | xargs -I % git
branch -r -d tags/%
Push to public repository
$ git push bare && git push --tags bare
$ cd /home/sites/thehellings.com/bibletime/bibletime.git
$ git update-server-info

I now have the ability to pull from that repository, all the SVN tags
are represented by git tags and all of the SVN branches are
represented by git branches (remote branches, to be precise).  You
should be able to do it with just a minimal amount of work to push it
into github or gitorious or even the sf.net git if you want.  Happy
converting!

--Greg

On Thu, Aug 5, 2010 at 7:10 PM, Greg Hellings <greg.hellings at gmail.com> wrote:
> I have now changed the line
> $ git config remote.bare.push "refs/remotes/*:refs/heads/*"
> to
> $ git config remote.bare.push "refs/*"
> and now I seem to be pushing the tags into the bare repository, and
> they're getting pulled down, but there was this message on cloning:
> "warning: remote HEAD reers to nonexistent ref, unable to checkout"
> so I cleared the bare repo and recreated it without the line
> $ git symbolic-ref HEAD refs/heads/trunk
>
> However, now I am getting all the tags out of the repository but only
> the origin/master (svn's HEAD) branch.
>
> Still a little ways to go!
>
> On Thu, Aug 5, 2010 at 6:48 PM, Greg Hellings <greg.hellings at gmail.com> wrote:
>> OK, I seem to have figured it out. I followed the directions at
>> https://git.wiki.kernel.org/index.php/GitFaq#svn-mirror but modified
>> them to suit our own purposes
>>
>> Initialize bare repo:
>> $ cd /home/sites/thehellings.com/bibletime
>> $ mkdir bibletime.git
>> $ cd bibletime.git
>> $ git init --bare
>> $ git symbolic-ref HEAD refs/heads/trunk
>>
>> Pull BibleTime
>> $ cd ~/
>> $ git svn clone https://bibletime.svn.sf.net/svnroot/bibletime
>> --ignore-paths="^trunk/(bibletime2|sandbox|website|website-2.0)"
>> (the above command took between 50 and 70 minutes, depending on
>> latency - not bandwidth)
>> $ git remote add bare /home/sites/thehellings.com/bibletime/bibletime.git
>> $ git config --unset remote.bare.fetch
>> $ git config remote.bare.push "refs/remotes/*:refs/heads/*"
>> Convert git branches that were originally SVN tags back into git tags
>> $ git branch -r | grep tags | sed -e 's/.*\///' | xargs -I % git tag
>> -a -m\"%\" % tags/%
>> Remove the fake tag/branches from the following
>> $ git branch -r | grep tags | sed -e 's/.*\///' | xargs -I % git
>> branch -r -d tags/%
>> Push to public repository
>> $ git push bare
>> $ cd /home/sites/thehellings.com/bibletime/bibletime.git
>> $ git update-server-info
>> (Not totally sure why this last one was necessary, but when I tried to
>> clone it to my workstation it failed and told me to run that command.
>> After running it, I could pull without an issue).
>>
>> Lots of thanks to the people in #git for pointing me in the right
>> direction for that.  We still have the extraneous bibletime/ directory
>> in the git repository, but one could easily do a git mv to move the
>> files out of that directory if you wanted to.  Anyway, if you need to
>> pull, you can grab it with
>> $ git clone http://bibletime.thehellings.com/bibletime.git
>> It should clone in about 30 seconds instead of the hour that it takes
>> to pull the full SVN.  I can't tell if it's pulling the tags from the
>> repository or not.  They aren't listing with "git tag" from my clone
>> even though they're listed in the original push directory, but I'm not
>> sure if they should or not.  Any hints on that one?
>>
>> --Greg
>>
>> On Thu, Aug 5, 2010 at 8:48 AM, Martin Gruner <mg.pub at gmx.net> wrote:
>>> Hi Jaak,
>>>
>>> today I tried to clone the "bibletime" part of our sf SVN repository
>>> into a git repository with
>>>
>>> git svn clone -s https://bibletime.svn.sourceforge.net/svnroot/bibletime
>>> bibletime
>>>
>>> unfortunately this will import all modules, also bibletime2, website and
>>> so on. What I want is a repository with only "bibletime", but for that
>>> the full history, tags and branches. Is that possible? If that requires
>>> reorganization of the SVN repository (don't know if that's technically
>>> possible), we can do so.
>>>
>>> mg
>>>
>>> _______________________________________________
>>> bt-devel mailing list
>>> bt-devel at crosswire.org
>>> http://www.crosswire.org/mailman/listinfo/bt-devel
>>>
>>
>



More information about the bt-devel mailing list