Skip to main content
GitHub tools wrap local git and the GitHub CLI (gh) so agents can branch, commit, push, and open pull requests from a repo checkout.
The user describes a git workflow; the agent runs GitHub tools to branch, commit, push, and open a pull request.
Prerequisites: git installed with the working directory inside a repository (github_create_branch, github_commit_and_push); origin remote configured for push; gh CLI installed and authenticated via gh auth login (github_create_pull_request).

Quick Start

1

Simple Usage

2

With Configuration

How It Works

Tools

github_create_branch(branch_name: str) -> str

Creates and checks out a new branch (git checkout -B). Returns a success message or an error string.

github_commit_and_push(commit_message: str) -> str

Stages all changes, commits, and pushes to origin on the current branch. Returns a success message, "No changes to commit.", or an error string.

github_create_pull_request(title, body, head_branch, base_branch="main") -> str

Creates a pull request via gh pr create.
Returns a success message with the PR URL, or an error if gh is missing or unauthenticated.

Common patterns

Best practices

Run gh auth login before agents call github_create_pull_request. The tool checks gh auth status first.
github_commit_and_push stages all changes (git add .). Review the working tree before the agent commits.
Include what changed, why, and linked issues — the body field supports markdown.
Tools return error strings rather than raising — check return values in hooks if you need hard failures.

Linear Bot

Example workflow using GitHub tools

Shell Tools

Similar CLI-wrapping tools