Git: removing selected commits from repository

Posted by xk0der on Stack Overflow See other posts from Stack Overflow or by xk0der
Published on 2009-01-30T12:23:01Z Indexed on 2010/03/27 0:33 UTC
Read the original article Hit count: 258

Filed under:
|
|

I would like to remove selected commits from a linear commit tree, so that the commits do not show in the commit log.

My commit tree looks something like:

R--A--B--C--D--E--HEAD

I would like to remove the B and C commits. So that they do not show in the commit log, but changes from A to D should be preserved. Maybe by introducing a single commit, so that B and C become BC and the tree looks like.

R--A--BC--D--E--HEAD

Or, ideally, after A comes D directly. D' representing changes from A to B, B to C and C to D.

R--A--D'--E--HEAD

Is this possible? if yes, how?

Some notes that might be helpful:
This is a fairly new project so has no branches as of now, hence no merges as well.

Side note: It's a personal project, so no, I'm not trying to destroy any evidence :)

© Stack Overflow or respective owner

Related posts about git

Related posts about commit