Skip to content

Latest commit

 

History

History
58 lines (39 loc) · 1.89 KB

File metadata and controls

58 lines (39 loc) · 1.89 KB

Clean Code and Smart Commits: A Practical Guide

1. Formatting code consistently


2. Enabling automatic formatting

This ensures your code stays clean without needing manual formatting each time.


3. Committing files often, in meaningful groups

Creating small, focused commits improves both your workflow and team collaboration.

Why this matters:

  • Clarity: Each commit tells a clear story (one feature, one fix, one change).
  • Debugging: Easy to find and undo the commit that caused a bug.
  • Collaboration: Teammates can review and understand changes faster.
  • History: Project log becomes a readable timeline, not a messy dump.
  • Safety: Progress is saved in safe, logical steps—less risk of losing work.

Appraoch 1: Using VS Code

Approach 2: Using Git commands

  1. Stage a changed file (git add)

e.g.: To stage a modified file named index.html

git add index.html
  1. Commit the staged changes: (git commit)

e.g.: To commit the staged changes with a short commit message

git commit -m "Fix syntax error"