Do not add what you have not read
Before preparing a change, inspect it:
git diff
This shows changes in the working folder that are not staged. Lines beginning with - were removed. Lines beginning with + were added.
After staging a file, inspect what the next commit will contain:
git diff --staged
This is your last review before recording the version.
One commit, one intention
Suppose Yassine changed a heading and fixed a menu bug. These changes answer different questions, so he prepares and commits them separately.
Clear messages:
Add portfolio introduction
Fix mobile menu closing behavior
Update setup instructions
Unclear messages:
update
changes
final
fix stuff
A teammate should understand the purpose without opening every changed line.
Select files deliberately
Prefer naming the file while learning:
git add index.html
git add . prepares all detected changes under the current folder. It is convenient, but it can include unrelated or private files. Always review git status and git diff --staged before committing.
A simple commit checklist
1. git status
2. git diff
3. git add <file>
4. git diff --staged
5. git commit -m "Clear action and purpose"
6. git status
Compare two histories
This message hides every detail:
Update project
The following history communicates the three intentions directly:
Add contact section
Fix contact email validation
Update contact documentation
The second history explains three separate decisions and makes later investigation easier.
What to remember
Read changes before recording them. A useful commit contains one coherent change and a message that states its purpose.