0

At now i have these commits:

A -> B -> C -> D -> E -> F

How can i remove changes from C to E, and get these:

A -> B -> F

Thanks.

Anton Vahmin
  • 339
  • 1
  • 4
  • 15
  • You can get `A -> B -> F'` easily enough, but it won't be the same actual commit as `F`. Have you pushed `C -> ... -> F`, and does that matter to you? – Useless Aug 09 '13 at 11:27

2 Answers2

3

in F:

git rebase -i B

and delete C,D,E from here. then save and quit.

It will create copy of commit F through

RiaD
  • 46,822
  • 11
  • 79
  • 123
1

Removing commits is disastrous if history is published. Another approach could be create a branch off B (say my_branch) and selectively cherry pick commit F

forvaidya
  • 3,041
  • 3
  • 26
  • 33