Why git rebase?

Gaurav Jain
1 min readFeb 5, 2020

As someone who explores tools strictly to the extent that they are relevant to the job at hand, I never found myself using the rebase functionality of git, that is, until today. So far I had considered it to be something that belonged to the realm of git power-users, but now I know of at least one valid use-case that would require using git-rebase.

And the use-case is “Squashing multiple commits into one”. If you accidentally find yourself committing prematurely such that the physical commits don’t match the logical commit units that you had in your mind, git rebase (among other things) allows you to squash/merge multiple physical commits into one. This link gives a good step-by-step guide on how to do it.

That said, I think if you are already in the habit of committing in small work units, you would rarely if ever, need to fall back to git-rebase. At least, that has been my experience using git in a professional setting for 4+ years.

--

--