0

For example, I have commits as follows (A..H are commit hashes):

A-B-C-D-E-F-G-H

Is there a way I could combine commits between C and G?

I do not want to use git rebase -i C, and manually change all the commits between C and G from pick to f,

because commit F is "Merge branch 'xxxxxxx' into xxxxxxx", in which there are too many commits, which I need to pick up and change too many picks to f.

I have tried this script as well, but it requires solving conflicts. I do not think I need solving conflicts as I am not merging from another branch but combine several previous commits together.

Community
  • 1
  • 1
L M
  • 1
  • 3
  • what do you mean with `combine historical commits`. if `A`..`H` are commit-hashes, there is no way to replace `C-G` with `X` and still have `H` on top of that. – umläute Oct 24 '16 at 19:35
  • Yep, `A..H` are commit hashes. I think at least by using interactive rebase I can combine and replace `C-G` with `C` and still have `H`. – L M Oct 24 '16 at 19:50
  • 2
    If commit `F` really is a *merge* commit (with two or more parents), you cannot combine it this way. In any case you will not *keep* commit `H`, you will *copy* commit `H` to a new copy `H'` that will have a different hash ID. – torek Oct 24 '16 at 22:01
  • So you want to change the history but leave it unchanged? – Thibault D. Oct 25 '16 at 06:30
  • @ThibaultD. that's correct. I want to change history but leave as many commits unchanged as possible. – L M Oct 25 '16 at 20:15
  • As torek said, whenever you change a commit X, all the following commits will have to change too. So if you want to group C D E, F will have to change too. – Thibault D. Oct 26 '16 at 06:03

0 Answers0