IS NOW Git Legit - Pauline Vos

Organize commits with interactive rebase, make atomic commits, and simplify history with fixup commits. Learn how to find bugs with Git bisect and master best practices for working with teammates.

Key takeaways
  • To organize commits, use interactive rebase to reorder and squash commits, making each commit a logical unit of work. Use git rebase --interactive to reorder commits.
  • Make atomic commits, which are small, self-contained commits that do one thing. This helps when reviewing and rehearsing commit history.
  • Use git commit --fixup to create fixup commits that simplify the commit history.
  • Use git rebase to reorder and squash commits.
  • Use git bisect to find the source of a bug by identifying the commit that introduced the issue.
  • When working with multiple teammates, use separate branches and rebase onto your own branch.
  • Use git push -f to force push your changes, be cautious when doing this as it can overwrite others’ changes.
  • Wrapping commit messages at 72 characters improves readability.
  • Prefixing commit messages with a timestamp or ID helps identify the exact commit.
  • Using atomic commits simplifies merge conflicts.
  • Once commits are merged into main branch, rewriting history is difficult.
  • Protect main branch against force pushing.
  • Use interactive rebase and squash commits to keep commit history clean.
  • Use git log --one-line to view commit history in a concise format.
  • Use gitmoji to add emojis to commit messages.
  • Use Oh My Zsh or other shell customizations to improve Git workflow.