Skip to content

Practices

Git practices that scale with a team

The habits that keep history readable, main stable, and collaboration smooth.

Weak messages

  • updates
  • fix stuff
  • changes
  • final final
  • working now

Improved messages

  • feat: add branch comparison view
  • fix: preserve staged file version after edit
  • docs: explain fast-forward merges
  • refactor: extract commit graph layout engine

Branch practices

Keep work isolated, focused, and short-lived.

  • Do not develop directly on main.
  • Create one branch per task.
  • Keep branches focused on a single concern.
  • Keep branches short-lived to avoid drift.
  • Sync with the target branch regularly.
  • Delete branches after they are merged.
  • Avoid mixing unrelated changes in one branch.

Branch naming

Use a consistent, descriptive prefix convention.

  • feat/user-authentication
  • fix/login-redirect
  • docs/git-rebase-guide
  • refactor/graph-layout
  • test/commit-parser
  • chore/update-dependencies
  • hotfix/payment-failure

Commit practices

Write commits your future teammates will thank you for.

  • Make commits atomic — one logical change each.
  • Write clear, specific messages.
  • Use imperative language: add, fix, refactor.
  • Explain why when the reason is not obvious.
  • Avoid huge mixed commits.
  • Avoid meaningless messages like 'updates'.
  • Review staged changes before committing.

Pull request practices

Make your changes easy and pleasant to review.

  • Keep pull requests focused and small.
  • Write a useful description.
  • Link the related issue.
  • Include testing instructions.
  • Add screenshots for UI changes.
  • Respond professionally to feedback.
  • Resolve conversations after addressing them.
  • Never merge failing checks.
  • Review the final diff before merge.

Review practices

Review for substance, not just style.

  • Review correctness and edge cases.
  • Review architecture and readability.
  • Review tests and coverage.
  • Consider security and performance implications.
  • Ask questions rather than assuming.
  • Separate blocking issues from suggestions.

Main-branch practices

Protect the branch everything depends on.

  • Protect main with branch rules.
  • Require pull requests and review.
  • Require passing status checks.
  • Prevent force pushes and deletion.
  • Keep main deployable at all times.
  • Tag releases.

Safety practices

Know which operations can lose work — and why.

  • Force-pushing shared branches can destroy teammates' commits.
  • git reset --hard discards uncommitted changes irreversibly.
  • Rebasing published history causes confusion and duplicates.
  • Never commit secrets; use environment variables and .gitignore.
  • Handle large binaries carefully (consider Git LFS).
  • Ignore generated files with .gitignore.
  • Review commits before pushing.