Skip to content

Commit 8f4e78c

Browse files
authored
fix(doc): add pre-commit example
1 parent da030b1 commit 8f4e78c

1 file changed

Lines changed: 24 additions & 0 deletions

File tree

README.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,3 +25,27 @@ git reset --hard 8f19d216282d1516ad3fedf7b28e2bebb23b36c6
2525
git push -f origin main
2626

2727
</pre>
28+
29+
30+
### Pre-commits
31+
32+
pre-commit solo analiza los archivos que están en el staging area (o sea, los que ya hiciste git add).
33+
<br>Si creas un archivo nuevo (echo "superdupersecret" > hola.txt) pero no lo agregas al índice, pre-commit no lo ve.
34+
<br>
35+
<pre>
36+
37+
### Ejemplo:
38+
39+
echo "superdupersecret" > hola.txt
40+
git add hola.txt
41+
git commit -m "nuevo archivo"
42+
# antes de hacer el push...
43+
pre-commit run --all-files
44+
45+
46+
47+
### Resumen
48+
49+
Archivos nuevos necesitas git add antes de que pre-commit los vea.
50+
Archivos en staging se analizan automáticamente en cada git commit.
51+
Revisión global usa pre-commit run --all-files.

0 commit comments

Comments
 (0)