git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* pushing a project started in git back to a subversion repository...
@ 2007-07-02 20:29 Patrick Doyle
  2007-07-03  4:37 ` Jeff King
  0 siblings, 1 reply; 3+ messages in thread
From: Patrick Doyle @ 2007-07-02 20:29 UTC (permalink / raw)
  To: git

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2007-07-03 15:06 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-07-02 20:29 pushing a project started in git back to a subversion repository Patrick Doyle
2007-07-03  4:37 ` Jeff King
     [not found]   ` <e2a1d0aa0707030656h63676f49l36579197ef662232@mail.gmail.com>
     [not found]     ` <20070703142633.GC18597@coredump.intra.peff.net>
2007-07-03 15:06       ` Patrick Doyle

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).