I have a repository, it's only mine, so there's no problem on breaking anything. Also there's only one branch, I think that makes things easier. Let's say I have this 7 commits:
A -> B -> C -> D -> E -> F -> G
And I want to delete commits C and D
A -> B -> E -> F -> G
Being A the first commit ever made, and G the last commit.
How can I do that? Without touching my code, just the git history.
The only thing I know I can do is reset the Head, but that won't work since I don't want to remove E, F and G.
You can do an interactive rebase:
That will replay all commits after
B
, but with the opportunity for you to drop the commits you don't want.