build: add pre-commit hook template
This commit is contained in:
parent
eeae2e69f3
commit
d03f1ca906
2 changed files with 22 additions and 1 deletions
11
.pre-commit
Normal file
11
.pre-commit
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
#!/bin/sh
|
||||
FILES=$(git diff --cached --name-only --diff-filter=ACMR | sed 's| |\\ |g')
|
||||
[ -z "$FILES" ] && exit 0
|
||||
|
||||
# Prettify all selected files
|
||||
echo "$FILES" | xargs keep-sorted
|
||||
|
||||
# Add back the modified files to staging
|
||||
echo "$FILES" | xargs git add
|
||||
|
||||
exit 0
|
||||
12
README.md
12
README.md
|
|
@ -1 +1,11 @@
|
|||
# dots
|
||||
# dots
|
||||
## build
|
||||
### `keep-sorted` pre-commit hook
|
||||
copy the pre-commit hook to `.git/hooks`
|
||||
```bash
|
||||
cp .pre-commit .git/hooks/pre-commit
|
||||
```
|
||||
make it executable
|
||||
```bash
|
||||
chmod +x .git/hooks/pre-commit
|
||||
```
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue