Today I Learned: collection of notes, tips and tricks and stuff I learn from day to day working with computers and technology as a developer

View project on GitHub

Squash Merge

Often when working on a branch you have several commits before you end with the solution you want. All this back and forth, experiments, house-keeping etc. is important, but it can make your clutter up commit history.

In order to get a clean history, squashing merges, result in a more readable commit log.

$ git checkout master
$ git merge --squash bugfix_branch
$ git commit

Omitting the -m parameter lets you modify a draft commit message containing every message from your squashed commits before finalizing your commit.