Sometimes you want to squash, or combine, earlier commits back in your history. This is one way you can do that.
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>
f to the commits (or
squash- modify commit message
fixup- 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: