Git Best Practices for Developers
A practical guide to using Git well on a team, checked against the official Git documentation and the Pro Git book. It covers commits and messages, branches and pull requests, rebase vs merge, safe history rewriting, keeping secrets out, .gitignore, commit signing and how to recover from mistakes.
7
Sefism · Oct 2026
26
Sefism · Oct 2026
8
Sefism · Oct 2026
Stacks and tools
Sefism · Oct 2026
Best practices
Web Development
Sefism
15 min read
Intermediate
Free
What this best practices guide is
A practical guide to using Git well on a team, checked against the official Git documentation and the Pro Git book. It covers commits and messages, branches and pull requests, rebase vs merge, safe history rewriting, keeping secrets out, .gitignore, commit signing and how to recover from mistakes.
It has 7 chapters and 26 practices, each with why it matters, what to do and what to avoid. For developers and CS students.
Chapter by chapter
1. Commits and commit messages (4 practices)
How big a commit should be and how to write a message that still makes sense a year from now.
2. Branches and pull requests (4 practices)
A branching flow that keeps the main branch releasable and pull requests easy to review.
3. Rebase vs merge (4 practices)
When to rebase, when to merge, and the one rule that keeps rebasing safe.
4. Rewriting history safely (3 practices)
How to force push without losing anyone's work, and how to undo commits that are already shared.
5. Secrets and .gitignore (4 practices)
Keep credentials and generated files out of the repository from day one, and know exactly what to do if a secret leaks.
6. Signing commits and tags (3 practices)
Prove that commits and releases really come from you, using the SSH key you probably already have.
7. Recovering from mistakes (4 practices)
Almost nothing you commit is ever really lost. These are the commands that get you out of the usual messes.
How it works on Sefism
The guide reads like a short course: a syllabus, then one chapter per page in a focused reader, with a quiz at the end of each chapter for members. The opening chapters are open to everyone. Adding it to your account uses credits, opens every chapter and keeps your progress.
Every claim is checked against the sources listed on the page (8 cited).
Ready to start?
Opens on Sefism in a new tab.
Stuck on something specific?
Writing only gets you so far. If you want an answer to your situation rather than the general case, book a session and we will work through it together. Sessions are free for approved Sefism members, and a few slots open each week.
Follow along
New writing, resources and project ideas land here first.