This is a submission for the GitHub Copilot CLI Challenge
What I Built
GitBrew is a developer productivity tool that supercharges your Git workflow by combining GitHub Copilot CLI with custom shell automation. It turns complex, multi-step Git operations into simple natural language commands.
Ever found yourself googling "how to rebase interactively and squash the last 5 commits" for the 100th time? GitBrew solves that. It's a wrapper around Git that uses Copilot CLI to interpret what you want to do and translates it into the exact Git commands β then executes them safely with confirmation prompts.
Key Features
- πΊ Natural Language Git β Type
gitbrew "undo my last 3 commits but keep the changes"and it figures out the right commands - π Smart Conflict Resolution β When merge conflicts arise, GitBrew uses Copilot to explain each conflict and suggest resolutions
- π Commit Message Generation β Analyzes your staged changes and generates conventional commit messages
- π³ Branch Strategy Advisor β Suggests branching strategies based on your project's history and team patterns
- π‘οΈ Safety Net β Every destructive operation shows a preview and requires confirmation. Undo history for the last 10 operations
- π Workflow Analytics β Tracks your most common Git patterns and suggests aliases
Demo
GitHub Repository: github.com/ohmygod/gitbrew
Installation
npm install -g gitbrew
# Requires GitHub Copilot CLI to be installed and authenticated
gh auth login
gh extension install github/gh-copilot
Example Session
$ gitbrew "I accidentally committed secrets to the last commit, help"
πΊ GitBrew analyzing your request...
π Copilot suggests the following plan:
1. git reset --soft HEAD~1 # Undo last commit, keep changes staged
2. # Remove secret files from staging
3. echo "*.env" >> .gitignore # Add to gitignore
4. git add .gitignore
5. git commit -m "chore: update gitignore to exclude env files"
β οΈ This will modify your commit history. Continue? [y/N] y
β
Done! Secret files removed from Git history.
π‘ Tip: Consider using git-secrets or pre-commit hooks to prevent this in the future.
$ gitbrew "show me what changed this week across all branches"
πΊ GitBrew analyzing your request...
π Activity Report (Jan 26 - Feb 2, 2026):
main: 3 commits (+247 / -89 lines)
feature: 12 commits (+1,203 / -456 lines)
hotfix: 1 commit (+3 / -3 lines)
Top files changed: src/api/routes.ts (8 changes)
Most active contributor: @ohmygod (16 commits)
$ gitbrew commit
πΊ Analyzing staged changes...
π Suggested commit message:
feat(auth): add OAuth2 PKCE flow for mobile clients
- Implement PKCE challenge/verifier generation
- Add token exchange endpoint
- Update auth middleware to handle mobile sessions
- Add integration tests for PKCE flow
Use this message? [Y/n/edit] y
β
Committed: feat(auth): add OAuth2 PKCE flow for mobile clients
My Experience with GitHub Copilot CLI
GitHub Copilot CLI was the backbone of this entire project β not just as a feature of GitBrew, but as my primary development tool while building it.
How Copilot CLI Powers GitBrew
At its core, GitBrew pipes user requests through gh copilot suggest and gh copilot explain to generate Git command sequences. The magic is in the prompt engineering:
const { execSync } = require("child_process");
function askCopilot(userIntent, context) {
const prompt = `Given a git repository with the following state:
- Current branch: ${context.branch}
- Uncommitted changes: ${context.hasChanges}
- Last 5 commits: ${context.recentCommits}
The user wants to: ${userIntent}
Provide the exact git commands needed, one per line.`;
return execSync(`gh copilot suggest -t shell "${prompt}"`,
{ encoding: "utf-8" });
}
How Copilot CLI Helped Me Build GitBrew
Rapid Prototyping β I used
gh copilot suggestconstantly to figure out Node.js patterns I wasn't familiar with, like building interactive CLI prompts with Inquirer.jsShell Script Generation β The trickiest part was writing cross-platform shell scripts for Git operations. Copilot CLI generated POSIX-compliant scripts that work on macOS, Linux, and WSL
Test Writing β
gh copilot explainhelped me understand edge cases in Git's behavior (like detached HEAD states), which I then turned into test casesDocumentation β The README, man pages, and inline help text were all drafted with Copilot CLI and refined by hand
Impact on Development Speed
What would have taken me 3-4 weeks of evenings and weekends took about 10 days. The biggest time-saver was Copilot CLI's ability to explain complex Git internals β instead of diving into documentation, I could ask "explain what happens to the reflog when I do an interactive rebase" and get an immediate, actionable answer.
The meta aspect is fun too: I used an AI CLI tool to build a tool that uses AI CLI. It's turtles all the way down. π’
GitBrew is open source under the MIT license. PRs welcome!
Top comments (0)