-
In VS Code, right-click anywhere in the editor and choose "Format Document" from the context menu.
-
You can also use the shortcut:
- Windows/Linux:
Shift + Alt + F - macOS:
Shift + Option + F
- Windows/Linux:
-
More details: https://code.visualstudio.com/docs/editing/codebasics#_formatting
- Open your VS Code settings (user or workspace settings).
- Search for
editor format - Set
editor.formatOnSaveandeditor.formatOnPasteto true
This ensures your code stays clean without needing manual formatting each time.
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.
- In the Source Control panel, stage individual files instead of all changes.
- Commit only what is staged.
- Watch this video (around 12:50): https://www.youtube.com/watch?v=z5jZ9lrSpqk&t=705
- Stage a changed file (
git add)
e.g.: To stage a modified file named index.html
git add index.html
- Commit the staged changes: (
git commit)
e.g.: To commit the staged changes with a short commit message
git commit -m "Fix syntax error"
- Additional resource: W3School Git Tutorial