Skip to content

Commit 9a79ef4

Browse files
committed
add git hook
1 parent d5ffd58 commit 9a79ef4

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed

git-hooks-install.sh

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
#!/bin/sh
2+
3+
# git-hooks-install.sh
4+
# by wilsonmar at gmail.com
5+
# After the repo is cloned, this bash script copies
6+
# scripts in the repo's hooks folder into the .git/hooks
7+
# and sets permissions.
8+
9+
fancy_echo() { # to add blank line between echo statements:
10+
local fmt="$1"; shift
11+
# shellcheck disable=SC2059
12+
printf "\n$fmt\n" "$@"
13+
}
14+
15+
fancy_echo "Remove *.sample files ..."
16+
del .git/hooks/*.sample
17+
18+
fancy_echo "Copy hooks/git-commit into .git/hooks ..."
19+
cp hooks/prepare-commit-msg .git/hooks
20+
chmod +x .git/hooks/prepare-commit-msg
21+
22+
#cp hooks/git-commit .git/hooks
23+
#chmod +x .git/hooks/git-commit
24+
25+
cp hooks/git-push .git/hooks
26+
chmod +x .git/hooks/git-push
27+
28+
cp hooks/git-rebase .git/hooks
29+
chmod +x .git/hooks/git-rebase
30+
31+
ls .git/hooks
32+
33+
fancy_echo "Done with status $? (0=OK)."

0 commit comments

Comments
 (0)