Git
Rebase Commands
Rebase is a powerful tool for maintaining clean, linear commit history. Learn interactive rebase to squash, reorder, and edit commits, and understand when to rebase vs merge.
8 commands
Pro Tips
Use 'git rebase -i HEAD~n' for interactive rebase to squash, reorder, or edit recent commits.
The 'fixup' command in interactive rebase is like squash but discards the commit message - perfect for typo fixes.
Use 'git pull --rebase' instead of 'git pull' to avoid unnecessary merge commits on feature branches.
Common Mistakes
Never rebase commits that have been pushed to shared branches. This rewrites history and causes major issues for collaborators.
During a rebase, if you encounter conflicts, resolve them carefully - you're rewriting history.