I have a branch "master" which has 5 commits:
A --> B --> C --> D --> E (master)
Now I want to merge the intermediate commits B, C, and D into one because their changes are trivial. I wish the result after merging is:
A --> B' --> E (master)
I tried the command git rebase -i A D
and it results in a detached head that is not in the master branch. But I want to stay in the master branch, how can I do that?
git rebase -i
is the right thing here. Which instructions did you give in the todo-list? They should have beenpick A
,pick B
,squash C
,squash D
,pick E
.git rebase -i A D
, and it asked me to modify the commits B, C, D where I picked B and squashed C and D. And after saving, I was led to a detached head. I failed to dogit push origin
.git rebase -i A
orgit reset A && git commit