Labs ICT
โญ Pro Login

Rebase

1 min read | Git Tutorial
โญ

Want the full learning experience?

Get structured courses, certificates, projects, and instructor support with LabsICT Pro.

Explore Pro Courses

Rebasing rewrites history by replaying commits from one branch onto another. This creates a linear history and makes the project easier to follow. However, rebasing changes commit history, which can be problematic if the branch is already shared with others.

Rewriting History with Rebase

Use `git rebase branch-name` to move your current branch to the tip of another branch. Interactive rebase (`git rebase -i`) lets you squash, reorder, or split commits. Common commands include 'pick' (keep), 'edit' (modify), 'squash' (combine), and 'reword' (change message). Interactive rebase can be very useful for cleaning up your commit history.

$ git rebase develop
$ git rebase -i HEAD~3
$ git add -i

๐Ÿงช Quick Quiz

What command restructures commits to create a linear history?