The {$BRANCH_FILES} placeholder allows you to dynamically list files that have changed in your current branch.
Supported Hooks:
This placeholder is only functional for the following actions:
pre-pushpost-rewritepost-checkoutpost-merge
Note on pre-push: If you are pushing multiple refs at once, the placeholder will contain all changed files for all pushed refs.
Available Filters/Modifiers:
You can pipe the placeholder through several filters to refine the list of files:
|compare-to:<branch>: Compares the current branch against a specific branch (e.g., main). If not provided, it defaults to the branch's starting point from the reflog.|separated-by:<delimiter>: Defines the character used to separate the file list (e.g., a comma or space).|in-dir:<directory>: Limits the file list to a specific directory.|of-type:<extension>: Limits the file list to files with a specific extension (e.g., php).
# Compare current branch to main and separate by comma
{$BRANCH_FILES|compare-to:main|separated-by:,}
# List PHP files in the foo/bar directory
{$BRANCH_FILES|in-dir:foo/bar|of-type:php}