Skip to content

Commit 0317aad

Browse files
author
Aymin Jafari
committed
feat: add advanced/06-git-hooks
1 parent e5ac5f9 commit 0317aad

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

git-hooks.md

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Git Hooks
2+
3+
Git hooks are scripts that run automatically before or after Git commands.
4+
5+
## Usage
6+
- Place scripts in the `.git/hooks/` directory.
7+
- Common hooks: `pre-commit`, `post-commit`, `pre-push`.
8+
9+
## Explanation
10+
- Use hooks to enforce workflows, run tests, or automate tasks.
11+
- Hooks are local to your repository.
12+
13+
## Example
14+
```bash
15+
# .git/hooks/pre-commit
16+
#!/bin/sh
17+
echo "Running tests..."
18+
npm test
19+
```
20+

0 commit comments

Comments
 (0)