forked from lohrun/git-hooks
-
Notifications
You must be signed in to change notification settings - Fork 1
/
git-hooks.1
101 lines (101 loc) · 3.24 KB
/
git-hooks.1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
.TH GIT-HOOKS "" "" ""
.SH NAME
git-hooks \- A tool to manage project, user, and global Git hooks for multiple git repositories
.\" Man page generated from reStructuredText.
.
.SH SYNOPSIS
.INDENT 0.0
.INDENT 3.5
git hooks
.UNINDENT
.UNINDENT
.SH DESCRIPTION
.sp
git\-hooks lets hooks be installed inside git repositories, users home directory, and globally. When a hook is called by git, git\-hooks will check each of these locations for the hooks to run.
.SH OVERVIEW
.INDENT 0.0
.TP
.B Hooks can be very powerful and useful. Some common hooks include:
.INDENT 7.0
.IP \(bu 2
Spell check the commit message.
.IP \(bu 2
Check that the code builds.
.IP \(bu 2
Verify that any new files contain a copyright with the current year in it.
.UNINDENT
.TP
.B Hooks can be very project specific such as:
.INDENT 7.0
.IP \(bu 2
Verify that the project still builds
.IP \(bu 2
Verify that autotests matching the modified files still pass with no errors.
.IP \(bu 2
Pre\-populate the commit message with the \(aqstandard\(aq format.
.IP \(bu 2
Verify that any new code follows the \(aqstandard\(aq coding style.
.UNINDENT
.UNINDENT
.sp
or very specific to one person such as:
.INDENT 0.0
.INDENT 3.5
.INDENT 0.0
.IP \(bu 2
Don\(aqt allow a push to a remote repository after 1am in case I break something and will be asleep.
.IP \(bu 2
Don\(aqt let me commit between 9\-5 for projects in ~/personal/ as I shouldn\(aqt be working on them during work hours.
.UNINDENT
.UNINDENT
.UNINDENT
.sp
For more details on the different Git hooks that can be installed checkout the online documentation at \fI\%http://www.kernel.org/pub/software/scm/git/docs/githooks.html\fP
.SH LOCATIONS
.INDENT 0.0
.TP
.B git\-hooks provide a way to manage and share your hooks by allowing for the installation of hooks in three locations:
.INDENT 7.0
.IP \(bu 2
User hooks that are installed in ~/.githooks/
.IP \(bu 2
Project hooks that are installed in the .githooks directory inside of each project.
.IP \(bu 2
Global hooks that are specified with the hooks.global configuration option
.sp
Multiple global hooks directories can be specified by using a space between each path.
.UNINDENT
.TP
.B The contrib directory includes a number of useful hooks and can be set by doing the following:
> git config \-\-global hooks.global $PWD/contrib/
.UNINDENT
.SH CREATING HOOKS
.sp
To keep things organized git\-hooks looks for scripts in sub directories named after the git hook name. For example this project has the following pre\-commit script in the following location:
.sp
githooks/pre\-commit/bsd
.sp
When you run \(aqgit hooks\(aq with no arguments it will list all of the hooks installed on the system. It will run the hooks with the \-\-about argument to generate the description that is shown. Checkout the hooks in contrib for some examples.
.SH OPTIONS
.INDENT 0.0
.TP
.B \-\-install
Replace existing hooks in this repository with a call to git hooks run [hook]. Move old hooks directory to hooks.old
.TP
.B \-\-uninstall
Remove existing hooks in this repository and rename hooks.old back to hooks
.TP
.B \-\-help, \-h
Show help
.UNINDENT
.SH SEE ALSO
.INDENT 0.0
.INDENT 3.5
.INDENT 0.0
.IP \(bu 2
\fI\%http://www.kernel.org/pub/software/scm/git/docs/githooks.html\fP
.UNINDENT
.UNINDENT
.UNINDENT
.\" Generated by docutils manpage writer.
.