Skip to content

Commit

Permalink
Documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
mptnt1988 authored Oct 11, 2017
1 parent a9fc317 commit 2913faf
Showing 1 changed file with 19 additions and 6 deletions.
25 changes: 19 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,24 @@
# githooks
Git hooks examples in various languages
## Guides ##
Implement a script at this project root directory, then run below command to create symlink to it as a hook.
```bash
make create REPO=<local_repo_path> TYPE=<client_hook_type> SCRIPT=<script_path>
```
*<local_repo_path>* : root directory of a git local repository

*<client_hook_type>* : e.g, pre-push, pre-commit, post-commit,... See support/client_hooks.txt for full list

*<script_path>* : path to the script
## Quick Test (bash) ##
### INIT ###
This is to help test the implemented script.

'test' directory and its 2 sub-directories, one is a bare repository 'server' and the other is a cloning repository 'client', are created.

NOTE: 'test' directory is ignored by default.
NOTE: 'test' directory is git-ignored by default.

Currently, only Erlang and Python are supported.
### INIT ###
```bash
make init-escript
make init-py
Expand All @@ -16,13 +29,13 @@ For pre-push test:
make push
```
### post-push ###
There is no git support for post-push, and this is just a workaround.
There is no git native support for post-push, and this is just a workaround.

git-push will be wrapped and post-push script is invoked after git-push completes successfully.
git-push will be wrapped in git-pushq and post-push script is invoked after git-push completes successfully.

Create a symlink first:
```bash
ln -s $PWD/git-pushq.sh <any_dir_included_in_PATH>/git-pushq
ln -s $PWD/bin/git-pushq.sh <any_dir_included_in_PATH>/git-pushq
```
Then it can be used in the same way as git-push:
```bash
Expand All @@ -31,4 +44,4 @@ Then it can be used in the same way as git-push:
For post-push test:
```bash
make pushq
```
```

0 comments on commit 2913faf

Please sign in to comment.