diff --git a/sections/advanced.md b/sections/advanced.md index 442dbff1..02c637ea 100644 --- a/sections/advanced.md +++ b/sections/advanced.md @@ -885,3 +885,8 @@ tag or SHA) and will cache based on that. Using a branch name (or `HEAD`) for the value of [`rev`](#repos-rev) is not supported and will only represent the state of that mutable ref at the time of hook installation (and will *NOT* update automatically). + +## Detecting when `pre-commit` is running + +You can check for the existence of the `PRE_COMMIT` environment variable within +a hook to determine if it's being run from `pre-commit`.