git
Declarative git configuration. Manages your ~/.gitconfig and global gitignore from a single Lua table — no more hand-editing INI sections. Shortcuts like signing and lfs wire up multiple gitconfig sections at once, and extra lets you pass through tool-specific sections like delta or interactive.
lua
local git = require("rootbeer.git")Example
signing wires up user.signingkey, gpg.format, commit.gpgSign, and tag.gpgSign automatically. lfs = true emits the full [filter "lfs"] section. extra passes through arbitrary gitconfig sections.
lua
git.config({
user = {
name = "Aarnav Tale",
email = "aarnav@tale.me",
},
editor = "nvim",
pager = "delta",
signing = { key = "ssh-ed25519 AAAA..." },
lfs = true,
pull_rebase = true,
ignores = { ".DS_Store", "._*", "*~" },
extra = {
delta = { features = "color-only" },
},
})For per-machine overrides, see Multi-Device Config.
API Reference
config(cfg)
Applies git.Config to the system. Writes a gitconfig file at cfg.path and optionally a gitignore file next to it.
editorstringoptionalDefault editor for commits (e.g.
"nvim").extratable<string, table<string, boolean|string>>optionalAdditional gitconfig sections (e.g.
delta, interactive).ignoresstring[]optionalGlobal gitignore patterns. Written next to the gitconfig.
ignores_pathstringoptionalOverride path for the gitignore file. Defaults to
.gitignore next to the gitconfig.lfsbooleanoptionalEnable git-lfs filters (
filter.lfs section).merge_conflictstylestringoptionalMerge conflict style (e.g.
"diff3").pagerstringoptionalDefault pager for output (e.g.
"delta").pathstringoptionalWhere to write the gitconfig file. Defaults to
"~/.gitconfig".pull_rebasebooleanoptionalPull with rebase instead of merge.
signing(git.SigningConfig)optionalCommit and tag signing. Sets
user.signingkey, gpg.format, commit.gpgSign, and tag.gpgSign.usergit.UserConfigUser identity.
git.SigningConfig
formatstringoptionalSigning format. Defaults to
"ssh".keystringThe signing key (e.g. an SSH public key).
git.UserConfig
emailstringEmail address for commits.
namestringFull name for commits.