A Detailed Guide To Understand How Git-Rebase Works

Usage details and working principle

Dwen
16 min readJul 25, 2022
Photo by Andyone on Unsplash

After a week of in-depth study, I thoroughly understood the working principle of Git-Rebase. Today, I am going to write a more in-depth analysis blog and share it with you.

Understanding the Rebase command.

The documentation for the git rebase command says “Reapply commits on top of another base tip”, which literally means reapply commits on top of another base tip.

This definition sounds a bit abstract, but it can be understood as changing the base of a branch from one commit to another, making it appear as if the branch was created from another commit.

As shown below:

Suppose we create a Feature branch from Master’s commit A for new feature development, then A is the base end of Feature.

Then Master added two new commits B and C, and Feature added two new commits D and E.

Now for some reason, for example, the development of new features depends on commits B and C, and we need to integrate the two new commits of Master into the…

--

--

Dwen

I'm an independent entrepreneur, a developer and a father, enjoys speaking, writing, and sharing.