home / skills / openclaw / skills / commit

This skill creates a contextual git commit from current changes and pushes the branch, automating staging and upstream setup.

npx playbooks add skill openclaw/skills --skill commit

Review the files below or copy the command above to add this skill to your agents.

Files (2)
SKILL.md
712 B
---
name: commit
description: Create a git commit with a contextual message based on current changes, then push the branch.
allowed-tools: [Bash]
---

## Context

- Current git status: !`git status`
- Current git diff (staged and unstaged changes): !`git diff HEAD`
- Current branch: !`git branch --show-current`
- Recent commits: !`git log --oneline -10`

## Your task

Based on the above changes, stage everything, create one commit with a contextual message, and push the current branch.

Required sequence:
1. Stage changes.
2. Create a single commit.
3. Push the current branch to origin (use `--set-upstream origin <branch>` if needed).

Do not use interactive commands and do not output extra commentary.

Overview

This skill automates creating a concise, contextual git commit from the repository's current changes and pushes the branch to the remote. It is designed for archives and backup workflows where a single, descriptive commit should encapsulate all outstanding modifications. The skill stages all changes, composes an informative commit message based on status and diffs, and pushes the branch to origin.

How this skill works

The skill inspects the repository state by reading the working tree status, the diff against HEAD, the active branch name, and recent commits to infer context. It stages all unstaged and modified files, constructs one commit message that summarizes the changes, and performs a git commit. Finally, it pushes the current branch to the origin remote, setting upstream if the branch has no tracking reference.

When to use it

  • You have multiple small edits and want a single contextual commit summarizing them.
  • Preparing to push archived snapshots of skill versions to a remote repository.
  • When CI or backup processes expect a clean commit history before deployment.
  • Quickly capture and push local changes without crafting separate commits for each file.

Best practices

  • Review the diff before running the automation to ensure no secrets or unwanted files are included.
  • Use clear, present-tense language in commit messages so automated summaries are meaningful.
  • Keep commits focused; if changes span unrelated features, consider creating separate commits manually.
  • Ensure branch naming and remote configuration are correct to avoid accidental upstream changes.

Example use cases

  • Archiving the current state of all skills in a single snapshot commit before creating a release.
  • Backing up a work-in-progress branch when switching machines or contexts.
  • Committing and pushing consolidated cleanup and formatting changes across multiple files.
  • Rapidly capturing changes made during a maintenance window and pushing them to the remote.

FAQ

Will this skill push to a different remote name?

No — it targets the origin remote. Change the remote configuration before running if a different target is needed.

What happens if the branch has no upstream?

The skill sets the upstream for the current branch when pushing so the branch tracks origin/<branch>.

Can I preview the commit message before it is created?

This automation generates and uses a contextual message; preview capability should be implemented separately if you need confirmation.