# Gh Search Commits

> Use when searching commit history across GitHub repositories - provides syntax for filtering by author, committer, dates, hashes, and merge commits with proper exclusion handling

- **Type:** Skill
- **Install:** `agentstack add skill-aaddrick-gh-cli-search-gh-search-commits`
- **Verified:** Yes — security-reviewed for prompt injection and unsafe behavior
- **Seller:** [aaddrick](https://agentstack.voostack.com/s/aaddrick)
- **Installs:** 0
- **Category:** [Developer Tools](https://agentstack.voostack.com/c/developer-tools)
- **Latest version:** 0.1.0
- **License:** MIT
- **Upstream author:** [aaddrick](https://github.com/aaddrick)
- **Source:** https://github.com/aaddrick/gh-cli-search/tree/main/skills/gh-search-commits

## Install

```sh
agentstack add skill-aaddrick-gh-cli-search-gh-search-commits
```

Requires the [AgentStack CLI](https://agentstack.voostack.com/docs/cli). Works with Claude Code, Cursor, and any MCP-compatible agent.

## About

# GitHub CLI: Search Commits

## Overview

Search for commits **across GitHub repositories** using `gh search commits`. Filter by author, committer, dates, commit hashes, and more.

## When to Use This Skill

Use this skill when searching commits across GitHub:
- Finding commits by author or committer across repos/orgs
- Searching commit messages for keywords across repositories
- Filtering by commit dates or hashes in specific repos
- Looking for merge commits across an organization
- Searching in specific repositories or organizations
- Need to exclude certain results (requires `--` flag)

## Syntax

```bash
gh search commits [] [flags]
```

## Key Flags Reference

### Author & Committer Filters

| Flag | Purpose | Example |
|------|---------|---------|
| `--author ` | Filter by author username | `--author octocat` |
| `--author-name ` | Filter by author name | `--author-name "John Doe"` |
| `--author-email ` | Filter by author email | `--author-email john@example.com` |
| `--author-date ` | Filter by authored date | `--author-date ">2024-01-01"` |
| `--committer ` | Filter by committer username | `--committer octocat` |
| `--committer-name ` | Filter by committer name | `--committer-name "Jane Doe"` |
| `--committer-email ` | Filter by committer email | `--committer-email jane@example.com` |
| `--committer-date ` | Filter by committed date | `--committer-date "` | Filter by commit hash | `--hash 8dd03144` |
| `--parent ` | Filter by parent hash | `--parent abc123` |
| `--tree ` | Filter by tree hash | `--tree def456` |
| `--merge` | Filter merge commits only | `--merge` |

### Repository Filters

| Flag | Purpose | Example |
|------|---------|---------|
| `--owner ` | Filter by repo owner | `--owner github` |
| `-R, --repo ` | Search in specific repo | `--repo cli/cli` |
| `--visibility ` | Filter by visibility | `--visibility public` |

### Output & Sorting

| Flag | Purpose | Example |
|------|---------|---------|
| `-L, --limit ` | Max results (default: 30) | `--limit 100` |
| `--sort ` | Sort by author-date or committer-date | `--sort author-date` |
| `--order ` | Sort direction: asc or desc | `--order asc` |
| `--json ` | JSON output | `--json sha,author,commit` |
| `-w, --web` | Open in browser | `-w` |

## JSON Output Fields

Available fields: `author`, `commit`, `committer`, `id`, `parents`, `repository`, `sha`, `url`

## Exclusion Syntax (Critical!)

When using inline query exclusions (negations with `-`), you MUST use the `--` separator:

✅ Correct: `gh search commits -- "search-terms -qualifier:value"`
❌ Wrong: `gh search commits "search-terms" --flag=-value`
❌ Wrong: `gh search commits "search-terms" --flag=!value`
❌ Wrong: `gh search commits --author-not=username`

**Examples:**
- `gh search commits -- "fix -author:dependabot"` (exclude author)
- `gh search commits -- "merge -committer:bot"` (exclude committer)
- `gh search commits -- "deploy -merge:true"` (exclude merge commits)
- `gh search commits -- "refactor -author-date:2024-01-01"
gh search commits --committer-date "2024-01-01..2024-12-31"
```

### 3. Quoting Rules

**Multi-word search:**
```bash
gh search commits "bug fix"
```

**Date comparisons need quotes:**
```bash
gh search commits "refactor" --author-date "2024-01-01"` |
| Not quoting date comparisons | Shell interprets operators | Quote: `"` - After date
- `>=` - On or after date
- `<` - Before date
- `<=` - On or before date
- `..` - Date range: `2024-01-01..2024-12-31`

## Related

- GitHub search syntax: https://docs.github.com/search-github/searching-on-github/searching-commits
- For searching other resources: `gh-search-code`, `gh-search-issues`, `gh-search-prs`, `gh-search-repos`

## Source & license

This open-source skill is cataloged on AgentStack and links to its original source — we do not rehost the code.

- **Author:** [aaddrick](https://github.com/aaddrick)
- **Source:** [aaddrick/gh-cli-search](https://github.com/aaddrick/gh-cli-search)
- **License:** MIT

Install and usage instructions live in the source repository linked above.

## Pricing

- **Free** — Free

## Security capabilities

Automated source analysis of v0.1.0 — what this tool can access:

- **Network access:** no
- **Filesystem access:** no
- **Shell / process execution:** no
- **Environment & secrets:** no
- **Dynamic code execution:** no

*"Yes" means the capability is present in the source — more access means more to trust, not that it is unsafe.*


## Versions

- **0.1.0** — security scan: passed — Imported from the upstream source.

## Links

- Listing page: https://agentstack.voostack.com/l/skill-aaddrick-gh-cli-search-gh-search-commits
- Seller: https://agentstack.voostack.com/s/aaddrick
- Browse the marketplace: https://agentstack.voostack.com/browse

---
Listed on AgentStack — the marketplace for AI agent skills and MCP servers. Every listing is security-reviewed. Creators keep 70%.
