summaryrefslogtreecommitdiffhomepage
path: root/misc/git_hook/README.md
blob: 81c15dc58f7c337db0e9bee32dc73f8f67d39404 (plain)
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
# git_hook

Tailscale's git hooks.

The shared logic lives in the `githook/` package and is also imported by
`tailscale/corp`.

## Install

From the repo root:

    ./tool/go run ./misc/install-git-hooks.go

The script auto-updates in the future.


## Adding your own hooks

Create an executable `.git/hooks/<hook-name>.local` to chain a custom
script after a built-in hook. For example, put a custom check in
`.git/hooks/pre-commit.local` and `chmod +x` it. The local hook runs
only if the built-in hook succeeds; failure aborts the git operation.


## Changing the shared code

When you change anything under `githook/` or `launcher.sh`, bump
`HOOK_VERSION` in the same commit so every dev auto rebuilds on their next
git operation.

Because `tailscale/corp` imports `githook/`, also plan the downstream
update: after landing here, bump corp's `tailscale.com` dependency and
bump corp's own `misc/git_hook/HOOK_VERSION` on a separate commit. Both are
required.