Originally published on the old depletionmode / 2of1 blog (archived copy).
Sometimes it’s useful to ’squash’ commit; in essence merging them into a single commit.
This can be done using the interactive mode of rebase:
git rebase -i originThe commits can then be change from pick to either squash or fixup (squash that discards commit’s log message).
The order of the commits can be changed as well, so for example:
pick ea4f69f DVB: Increased signal timeout times
pick d58bac8 DVB access module format improvements
pick 5461a01 DVB-S scanning support
pick 1a5a61a DVB channel search dialog now shows ETA
pick 351bcd2 small syntax fixSay I want to squash 351bcd2 into 5461a01 and discard the log message, I simply change it as follows:
pick ea4f69f DVB: Increased signal timeout times
pick d58bac8 DVB access module format improvements
pick 5461a01 DVB-S scanning support
fixup 351bcd2 small syntax fix
pick 1a5a61a DVB channel search dialog now shows ETA