Git Commit
git_commitCreate a commit to save staged changes with your message. Record repository snapshots with options for custom authors, amendments, and GPG signing.
Instructions
Create a new commit with staged changes in the repository. Records a snapshot of the staging area with a commit message.
Commit Message Format: Pass commit messages as JSON string parameters. Multi-line messages are supported using standard JSON string escaping.
Examples:
Single line: { "message": "feat: add user authentication" }
Multi-line: { "message": "feat: add user authentication\n\nImplemented OAuth2 flow with JWT tokens.\nAdded tests for login and logout." }
Note: Do not use bash heredoc syntax. Literal escape sequences (\n, \t) in the message string are automatically normalized to their actual characters.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| path | No | Path to the Git repository. Defaults to session working directory set via git_set_working_dir. | . |
| message | Yes | Commit message. | |
| author | No | Override commit author (defaults to git config). | |
| amend | No | Amend the previous commit instead of creating a new one. Use with caution. | |
| allowEmpty | No | Allow creating a commit with no changes. | |
| sign | No | Sign the commit/tag with GPG. | |
| noVerify | No | Bypass pre-commit and commit-msg hooks. | |
| filesToStage | No | File paths to stage before committing (atomic stage+commit operation). | |
| forceUnsignedOnFailure | No | If GPG/SSH signing fails, retry the commit without signing instead of failing. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| success | Yes | Indicates if the operation was successful. | |
| commitHash | Yes | SHA-1 hash of the created commit. | |
| message | Yes | The commit message. | |
| author | Yes | Author of the commit. | |
| timestamp | Yes | Unix timestamp when the commit was created. | |
| filesChanged | No | Number of files changed in this commit. | |
| committedFiles | Yes | List of files that were committed. | |
| insertions | No | Number of line insertions. | |
| deletions | No | Number of line deletions. | |
| status | Yes | Repository status after the commit. |