git_hook

command
v1.99.0-pre Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 5, 2026 License: BSD-3-Clause Imports: 5 Imported by: 0

README

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.

Version bumps

The launcher rebuilds when the installed binary's version differs from the concatenation of two files:

  • githook/HOOK_VERSION (shared): bump when changing anything under githook/ or git-hook.go. Downstream repos pick it up after bumping their tailscale.com dependency.
  • misc/git_hook/HOOK_VERSION (repo-local, optional): bump to force a rebuild for repo-specific config changes without touching the shared version. This repo does not use one.

Documentation

Overview

The git-hook command is Tailscale's git hook binary, built and installed under .git/hooks/ts-git-hook-bin by the launcher at .git/hooks/ts-git-hook. misc/install-git-hooks.go writes the initial launcher; subsequent HOOK_VERSION bumps trigger self-rebuilds.

Adding your own hooks

To add your own hook alongside one we already hook, create an executable file .git/hooks/<hook-name>.local (e.g. pre-commit.local). It runs after the built-in hook succeeds.

Directories

Path Synopsis
Package githook contains the shared implementation of Tailscale's git hooks.
Package githook contains the shared implementation of Tailscale's git hooks.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL