Introduction
Rebasing changes the history of your commits. If you rebase commits that others have already used, it can cause confusion and conflicts. The golden rule is to never rebase commits that are public and shared with others.
When you want to clean up your local commit history before sharing your work.
When you want to update your feature branch with the latest changes from the main branch before merging.
When you want to avoid creating unnecessary merge commits in your private branch.
When you want to reorder or squash your local commits to make them clearer before pushing.
When you want to keep your local work tidy without affecting others.