Skip to content
Edit this page

new

Create a minimal template manifest in the current directory.

mkdir my-template
cd my-template
git tpl new

This creates template.toml:

#:schema https://noirbizarre.github.io/git-tpl/template.schema.json

name = "my-template"

The name comes from the current directory's basename, preserving spaces and Unicode. Names containing TOML special characters are escaped automatically. A filesystem root or a directory whose basename is not UTF-8 cannot supply a name; run the command in another directory instead. When invoked through a directory symlink, the physical directory supplies the name.

The schema directive enables editor completion and validation. git-tpl does not download the schema.

Existing manifests

An existing template.toml is never overwritten, including a directory or symlink at that path. The command reports tpl::ops::manifest_exists and exits with code 1. Edit the existing manifest or choose another directory.

Next steps

The command creates only the manifest and works outside a Git repository. Add files to render under template/, edit the manifest to declare any questions or computed values, then initialize a Git repository and commit your template when ready. The Quick Start walks through a complete example.

To create a project from an existing template, use init.

Output and exit codes

Human confirmation goes to stderr; --quiet suppresses it. With --json, stdout contains one success object:

{"ok": true, "path": "template.toml", "name": "my-template"}

path is relative to the invocation directory. Runtime failures use the standard JSON diagnostic envelope. Success exits with 0; a runtime failure exits with 1. Invalid command-line arguments exit with 2 before command execution.