Skip to content

addUpdatedFilesToGit

Adds updated files to the Git staging area and commits them with the new version message.

If the commit fails (for example, the pre-commit hook rejects a new word in the changelog) and the process is attached to an interactive terminal, the user is prompted to fix the issue (for example, add the missing word to cspell.json) and press Enter to retry. The retry re-stages all files, so the fix is picked up without restarting the whole release lifecycle. In a non-interactive environment (no TTY, such as CI), the error is re-thrown instead of prompting, so the script fails fast rather than hanging. Pass shouldVerifyCommit: false to skip the pre-commit hook entirely in such cases.

Import:

import { addUpdatedFilesToGit } from 'obsidian-dev-utils/script-utils/version';

Signature:

function addUpdatedFilesToGit(newVersion: string, options: AddUpdatedFilesToGitOptions): Promise<void>

Parameters:

ParameterTypeDescription
newVersionstringThe new version number used as the commit message.
optionsAddUpdatedFilesToGitOptionsThe AddUpdatedFilesToGitOptions controlling the commit behavior.

Returns: Promise<void> — A Promise that resolves when the files have been added and committed.


Links to this page: