tags:

views:

65

answers:

1

I recently converted a subversion repo, which had been converted from cvs before that and I've ended up with the following structure (simplified for clarity) at the bottom of the tree:

* master
|
...
|
|
* G 
|\
| * F
| * E
| * D
| * C Initial commit.
|
|
* A New repository initialized by cvs2svn.

The line from G-A contained unwanted commits which I've removed successfully with "git filter-branch". I'd like to be able to remove that line entirely, including the initial empty root commit at A and just have a single line going back to C.

So I'd like to remove A as a parent of G and allow it to be gc'd, but I'm not sure if that's possible.

+1  A: 

Use git filter-branch with a --parent-filter on G:

$ git filter-branch --parent-filter \
    'test $GIT_COMMIT = G && echo "-p F" || cat' HEAD

where you replace G and F with the actual SHA-1 values.

Greg Bacon
Thanks. That was spot on. The only difference was that I ended up using "-- --all" instead of "HEAD", as there were actually multiple branches which had G as an ancestor.
Munkymisheen
You're welcome. I'm glad it helped!
Greg Bacon