These are the two messages we want to squash into the earlier one (2 - added one file and squashed
).
Do an interactive rebase on at least 2 commits before the ones you want to squash, in this case 1 - removed all files
.
> git rebase -i <hash-commit>
Use either s
or f
to the commits (or squash
or fixup
).
squash
- modify commit messagefixup
- remove commit message
The two commits that should be changed are now added. Save and exit to go to the next file.
Comment out the commit messages that you want to change and rewrite the earlier commit (earlier named 2 - added one file and squashed
), now named whatever you want.
Save and the files will now be squashed with the earlier commit. This is how it looks now: