Git

git_hooks_install

Install Git Pre-commit Hook

Creates a pre-commit hook that runs Framework checks based on settings.yml settings.


Usage

git_hooks_install(config_file = NULL, force = FALSE, verbose = TRUE)

Arguments

Argument Description
config_file

Path to configuration file (default: "settings.yml")

force

Logical; if TRUE, overwrite existing hook (default: FALSE)

verbose

Logical; if TRUE (default), show installation messages

Details

Creates or updates .git/hooks/pre-commit to run enabled Framework hooks:

  • ai_sync: Sync AI assistant context files before commit
  • data_security: Run security audit to catch data leaks
  • check_sensitive_dirs: Warn about unignored sensitive directories

Hook behavior is controlled by git.hooks.* settings in settings.yml.

Returns

Invisible TRUE on success, FALSE on failure

Examples

# Install hooks based on settings.yml
git_hooks_install()

# Force reinstall (overwrites existing hook)
git_hooks_install(force = TRUE)

Source: R/git_hooks.R