You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+9-1Lines changed: 9 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -58,7 +58,7 @@ repos:
58
58
```
59
59
60
60
> [!IMPORTANT]
61
-
> If your `pre-commit` runs longer than expected, it is highly recommended to add `files` in `.pre-commit-config.yaml` to limit the scope of the hook. This helps improve performance by reducing the number of files being checked and avoids unnecessary processing. For example below:
61
+
> If your `pre-commit` runs longer than expected, it is highly recommended to add `files` in `.pre-commit-config.yaml` to limit the scope of the hook. This helps improve performance by reducing the number of files being checked and avoids unnecessary processing. Here's an example configuration:
62
62
63
63
64
64
```yaml
@@ -73,6 +73,14 @@ repos:
73
73
files: ^(src|include)/.*\.(cpp|cc|cxx|h|hpp)$
74
74
```
75
75
76
+
Alternatively, if you want to run the hooks manually on only the changed files, you can use the following command:
77
+
78
+
```bash
79
+
pre-commit run --files $(git diff --name-only)
80
+
```
81
+
82
+
This approach ensures that only modified files are checked, further speeding up the linting process during development.
0 commit comments