#1
[Image: download.jpg]

⎝⎝ A quick check before you commit ⎠⎠

Git can check a diff for whitespace errors and conflict markers. It is a small hygiene check that can catch accidental noise before review.

For changes not staged yet
Code:
git diff --check
This checks the working-tree changes against the index.

For staged changes
Code:
git diff --cached --check
This checks the staged diff against HEAD (the default comparison).

If Git reports a line, inspect and fix it, then run the same check again. No output means this check found no issue of those kinds in that diff; it does not prove the change is correct. Review the diff yourself and run the project's tests too.

Official reference
Git documentation: git diff --check and --cached

if this helped you, a like is appreciated — wishing you the best