How to squash (merge with the next) during rebase?

This is my pseudo-tree:

A---B---C---D (master)

I started an interactive reboot from the root: git rebase --root -iand set the command editfor all commits. Here is an example:

e b83fa60 Initial content (A)
e 9a82ddf Update license information (B)
e fa8cb80 Rewrite readme (C)
e 0525f07 Update email address (D)

Now I settled on B during rebase:

A---B---C---D (master)
    ^

At this point, I want to “merge” or “squash” B with the next C-commit. How can i do this?

+4
source share
1 answer

git rebase --continuestops you on the next commit e, which is C, and then it git reset HEAD^ && git add . && git commit --amendwill issue the current (C) previous (B). Although I personally will just continue rebase and repeat with marking C as sor f- much easier and faster.

+5
source

Source: https://habr.com/ru/post/1611995/


All Articles