Skip to content

Commit 669e4d9

Browse files
committed
Updated docs
1 parent 4fd290d commit 669e4d9

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

README.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,23 @@ $ npm install -g git-stats
1414
### Catching the `git commit` command
1515
Would you like to catch and automatically store the commits when you do `git commit`?
1616

17+
#### Using `git` hooks
18+
The way I recommend to track your git commits is to use git hooks. Run the following command to initialize the `post-commit` git hook.
19+
20+
```sh
21+
# Using curl
22+
curl -s https://raw.githubusercontent.com/IonicaBizau/git-stats/git-hooks/scripts/init-git-post-commit | bash
23+
24+
# ...or wget
25+
wget -qO- https://raw.githubusercontent.com/IonicaBizau/git-stats/git-hooks/scripts/init-git-post-commit | bash
26+
```
27+
28+
Then, you have to run `git init` into your existing git repositories from your local machine (that's because the `post-commit` should be updated). This
29+
step will not be needed after clonning a repository (the git hooks will be added automatically from `~/.git-templates`).
30+
31+
#### Overriding the `git` command
32+
One of the solutions is becoming a mad scientist, overriding the `git` command with a function. However, this may not work for you if you're using `zsh`.
33+
1734
If so, put the following lines in your `~/.bashrc` (or `~/.bash_profile` on OS X) file:
1835

1936
```sh

0 commit comments

Comments
 (0)