pushing a project started in git back to a subversion repository...

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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
-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux