xx
.md

git_commit

git_commit stages changes and creates a commit in an existing project-relative Git repository. It returns a dependency and does nothing when no staged tree changes exist, making repeated runs safe by default.

When available on the host PATH, the Git CLI creates commits and honors host configuration, hooks, and signing setup. xx falls back to go-git when the Git CLI is unavailable. The fallback supports file-based OpenPGP and SSH signing plus SSH-agent keys; its signing key and passphrase support is narrower than the Git CLI.

Arguments

ArgumentRequiredDescription
messageYesCommit message.
repositoryNoProject-relative Git worktree directory. Defaults to ..
pathsNoRepository-relative paths to stage. Defaults to all changes, including untracked files and deletions.
author_nameNoCommit author name. Must be used with author_email. Defaults to Git configuration.
author_emailNoCommit author email. Must be used with author_name. Defaults to Git configuration.
allow_emptyNoCreate a commit when tree has no changes. Defaults to False.
depsNoDependencies to complete before staging and committing.

Example

load("@git@1", "git_commit")

commit = git_commit(
    repository=".xx/output",
    message="Update generated files",
    author_name="xx",
    author_email="[email protected]",
    deps=[generate],
)