Introduction
When multiple people work on the same project, the history can look messy with many branches merging. Rebasing helps by moving your changes on top of the latest work, making the history look like a straight line. This makes it easier to understand what happened and when.
When you want to keep your feature branch up to date with the main branch without creating extra merge commits
When you want to prepare your branch for a clean merge into the main branch
When you want to simplify the project history for easier review and debugging
When you want to avoid confusing merge commits that make the history look like a tree
When you want to replay your changes as if they were made after the latest commits on the main branch