From: "Patrick Doyle" <wpdster@gmail.com>
To: git@vger.kernel.org
Subject: pushing a project started in git back to a subversion repository...
Date: Mon, 2 Jul 2007 16:29:11 -0400 [thread overview]
Message-ID: <e2a1d0aa0707021329p29242393ua10817c85ca7422a@mail.gmail.com> (raw)
Well, I think I've parsed through the documentation and tips enough to
finally produce a script that does what I want it to do... and that
was: "I started a project, tracking the revisions with git, and I want
to track the changes and revisions on our company Subversion server."
Here is what I did:
1) packed up the existing git repository with "git-pack-objects"
$ git-rev-list master | git-pack-objects --revs --stdout > ../mypack
2) Used git-rev-list to find the name of first and last commits in my repo.
*** 1st question: ****
I can use
$ git-rev-list -n 1 master
to get the most recent commit. Is there a similar shortcut to get the
very first commit? (I used used "tail -1" to get the last line out of
git-rev-list
3) Cloned the SVN repository, which I had previously created with an
empty directory into which I wanted to import my new project
$ git-svn clone url://path/to/repo/topdir
4) unpacked the packfile into the new .git repo
$ cd topdir
$ git-unpack-objects < ../mypack
5) Created a .git/info/grafts file with the first commit from my old
.git repo grafted onto the single (empty directory) commit of this new
repo
$ echo XXX YYY > .git/info/grafts
6) Here's the scary part -- I overwrote .git/refs/heads/master with
the last commit from my old repo, so now "master" points to a chain of
commits going back to the beginning of time in the old repo and now
grafted onto the empty directory commit of my new repo.
**** 2nd question: ****
How many of you cringed when I said I did this? If so, why?
7) Fetched the files into my empy directory
$ git checkout
8) And committed them back to the SVN repo:
$ git-svn dcommit
**** Last question: ****
What happened to all of those objects I imported from the pack file?
I can still see them in the .git/objects/*/* directories, but they
don't show up in git-ls-revs. git-fsck doesn't report any errors.
git-gc seems like it packs them up -- I get 193 objects packed into
the pack file compared to 167 in a fresh clone of the (newly updated)
svn reposistory
I'm also curious what experts would think of my fumbling efforts to
transfer this git-managed project into a git/svn-managed project,
maintaining the initial history. Did I go tremendously out of my way
to do something that was a one-line command?
--wpd
next reply other threads:[~2007-07-02 20:29 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-07-02 20:29 Patrick Doyle [this message]
2007-07-03 4:37 ` pushing a project started in git back to a subversion repository Jeff King
[not found] ` <e2a1d0aa0707030656h63676f49l36579197ef662232@mail.gmail.com>
[not found] ` <20070703142633.GC18597@coredump.intra.peff.net>
2007-07-03 15:06 ` Patrick Doyle
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=e2a1d0aa0707021329p29242393ua10817c85ca7422a@mail.gmail.com \
--to=wpdster@gmail.com \
--cc=git@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).