Git Hooks/Debug shell hook with xtrace

Trace shell execution for debugging.

Section: Hook Lifecycle Commands

Debug shell hook with xtrace

sh
bash
set -x
# add near top of hook script

Learn the surrounding workflow

Compare similar commands or jump into common fixes when this command is part of a bigger troubleshooting path.

Related commands

Same sheet · prioritizing Hook Lifecycle Commands
Show hooksPath
See whether Git uses a non-default hook directory.
OpenIn sheetbashsame section
Skip client hooks for one commit
Bypass pre-commit and commit-msg hooks when necessary.
OpenIn sheetbashsame section
Skip pre-push hook
Bypass pre-push hook for one push.
OpenIn sheetbashsame section
Pre-commit hook path
Default path for pre-commit hook script.
OpenIn sheetsh1 tag match
Pre-commit lint script
Run linting before commit and fail on error.
OpenIn sheetsh1 tag match
Commit-msg hook path
Default path for commit-msg hook script.
OpenIn sheetsh1 tag match