1. Most used commands
git statusWhat it doesDisplays the status of the Working Tree, Staging Area, and modified files
When to use itBefore each commit or after modifications
Example
git statusgit status -sWhat it doesDisplays the status of files in a compressed, compact format
When to use itWhen editing a large number of files and preferring a quick list
Example
git status -sgit diffWhat it doesDisplays unprocessed changes (between Working Tree and Staging Area)
When to use itto review modifications before git add
Example
git diffgit diff --cachedWhat it doesOnly displays ready-to-commit changes in the Staging Area ready to commit
When to use itto review what will actually go into the next commit
Example
git diff --cachedgit add <file>What it doesPrepare a selected file to the Staging Area
When to use itto prepare a specific file precisely and avoid making all the changes at once
Example
git add src/index.tsgit add .What it doesPrepare all changes to the current path and subfolders
When to use itto process all review edits at once
Example
git add .git add -pWhat it doesAn interactive installation that allows reviewing and selecting specific parts (Hunks) of the file
When to use itWhen there are multiple edits in a file and you want to split them over multiple commits
Example
git add -p src/app.jsgit commit -m "msg"What it doesRecords a new Snapshot of changes equipped with a clear message
When to use itAfter completion of a standalone logical feature or modification
Example
git commit -m "feat: add user authentication"