Labs ICT
โญ Pro Login

Rebase

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
Try it Yourself โ†’

๐Ÿงช Quick Quiz

What command restructures commits to create a linear history?