DEV Community

Cover image for How I Used GitHub Copilot CLI to Make Git 10x Less Scary
Shingirayi Innocent Mandebvu
Shingirayi Innocent Mandebvu

Posted on

How I Used GitHub Copilot CLI to Make Git 10x Less Scary

GitHub Copilot CLI Challenge Submission

What I Built

I built Hermes 🪽 — an AI-powered Git CLI that turns natural language into safe, explainable Git operations.

Honestly? I built this because I was tired of Git anxiety. You know that feeling when you're about to run git rebase or resolve a conflict and you're like... "please don't break everything"? Yeah, that feeling.

Git is incredibly powerful, but it's also unforgiving. Even experienced devs regularly mess up rebases, panic during conflicts, or forget what state their repo is in. I wanted something that could stand beside me and say "here's what's happening, here's what's safe, and here's why."

But here's where it gets interesting: I didn't just want another Git wrapper. I wanted something that actually learns from your project, tracks how much time it saves you, and proves its value with data. Because let's be real — if a tool can't show me it's making me more productive, why use it?

Key features:

  • 🧠 Intent-first commands — "sync my branch" instead of memorizing flags
  • 📊 Built-in analytics — See exactly how much time you're saving
  • 🛡️ Safety by default — Shows you commands before running them
  • 🔄 Workflow shortcuts — Turn 50+ commands into 5 per day
  • 🎯 Context-aware — Learns your project's patterns and conventions

Demo

Live on npm: https://www.npmjs.com/package/hermes-git
GitHub: https://github.com/simandebvu/hermes-cli

Installation

npm install -g hermes-git

Real-World Examples

Starting a new feature:

 $ hermes start "oauth2 authentication"
🚀 Starting new task...
📍 Base branch: main
🌿 New branch: feature/oauth2-authentication
💭 Creating branch from clean state ensures no unexpected commits. Safe to proceed.

    $ git checkout main
    $ git pull
    $ git checkout -b feature/oauth2-authentication

✅ Successfully created and switched to feature/oauth2-authentication

Enter fullscreen mode Exit fullscreen mode

Understanding a conflict:

$ hermes conflict explain

🔍 Analyzing conflicts...
⚔️  Conflicts detected:
    • src/auth/login.ts

🔍 Analysis:
  Main branch refactored authentication to use async/await
  patterns, while your feature branch added comprehensive
  error handling with try-catch blocks.

Both changes are valuable:
  - Main: Modern async patterns improve code readability
  - Your branch: Error handling prevents crashes

Recommended strategy: Merge both approaches
  1. Keep the async/await structure from main
  2. Integrate your error handling improvements
  3. Test the combined implementation
Enter fullscreen mode Exit fullscreen mode

Checking your productivity:

$ hermes stats

╔══════════════════════════════════════════════════════╗
║  Hermes Efficiency Report - Last 30 Days           ║
╚══════════════════════════════════════════════════════╝
⏱️  Time Saved:        12.4 hours
🚀  Commands Run:      123 (85% reduction)
📈  Efficiency Gain:   +34% compared to raw Git

Top Time Savers:
1. workflow      ████████████ 45x
2. start         ████████     32x
3. sync          ██████       24x

💡 Weekly projection: ~2.9 hours saved
💡 Monthly projection: ~12.4 hours saved
Enter fullscreen mode Exit fullscreen mode

Quick Walkthrough

Here's what a typical workflow looks like:

  1. Morning sync: hermes workflow daily-sync # Fetch all, show status, suggest actions
  2. Start new work: hermes start "user profile refactor" # Smart branch creation
  3. Save progress: hermes wip -m "checkpoint" # Decides commit vs stash
  4. Sync with main: hermes sync # Evaluates rebase vs merge
  5. Ready for PR: hermes workflow pr-ready # Fetch, rebase, force-with-lease push

Each command explains why it's doing what it's doing. No surprises, no hidden magic.

My Experience with GitHub Copilot CLI

This project fundamentally depends on GitHub Copilot CLI — it's not just a feature, it's the reasoning engine behind every decision Hermes makes.

The Integration Journey

When I started, I thought: "Okay, I'll use Copilot CLI to generate some commands." But I quickly realized it could do so much more.

Here's what I learned:

The new Copilot CLI is a game-changer

Context is everything
Instead of just asking "what Git command should I run?", I learned to give Copilot CLI rich context:

```typescript
   const prompt = `
    Repository State:
    - Branch: feature/auth
    - Status: 5 files changed, 2 conflicts
    - Behind main: 12 commits
    - Working directory: dirty

   User wants to: "sync my branch without losing work"

   Evaluate whether rebase or merge is safer given:
       - Branch has unpushed commits
       - Conflicts detected
       - Working directory not clean

   Provide step-by-step commands with safety explanations;
```
Enter fullscreen mode Exit fullscreen mode

The AI gives much better guidance when it knows the full picture.

I built Hermes on this new architecture:

const response = await execAsync('copilot -p "${prompt}" --model claude-sonnet-4.5 --allow-all-tools --silent');
Enter fullscreen mode Exit fullscreen mode

JSON responses need love

Copilot CLI sometimes wraps JSON in markdown code blocks:

  { "commands": [...] }
Enter fullscreen mode Exit fullscreen mode

I wrote a helper to strip these automatically:

 function stripMarkdownCodeBlock(text: string): string {
    const match = text.match(/```

(?:json)?\s*([\s\S]*?)\s*

```/);
    return match ? match[1].trim() : text.trim();
  }
Enter fullscreen mode Exit fullscreen mode

Small detail, but crucial for reliability.

Safety first, always

I configured Copilot CLI with --allow-all-tools for automation, but Hermes always shows commands before executing:

 displayStep(command);  // Show user what's about to run
  await executeGitCommand(command);  // Then execute

Enter fullscreen mode Exit fullscreen mode

This way, Copilot can reason about tools and operations, but users stay in control.

What Surprised Me

The quality of explanations is incredible. When you ask Copilot CLI to explain why a conflict happened, it doesn't just say "files changed in both branches" — it gives you context:

"Main refactored authentication to async/await, while your branch added error handling. Both changes are valid.
Here's how to merge them..."

That level of understanding is what makes Hermes actually useful instead of just another Git wrapper.

It's fast. Really fast. 2-5 seconds to analyze a complex repo state and generate a plan. Fast enough that itdoesn't break your flow.

It learns patterns. When you use Hermes with your project's config, Copilot CLI picks up on your naming conventions, workflow preferences, and starts giving better suggestions over time.

The "Aha!" Moment

The moment I knew this worked was when I was deep in a messy merge conflict, ran hermes conflict explain, and the AI said:

"This conflict happened because you renamed a function while someone else refactored its logic. Both changes are
improvements. Keep the new name and the refactored logic."

I thought: "Holy crap, that's exactly what a senior dev would tell a junior in a code review." That's when I realized we're not building tools anymore — we're building mentors.

Challenges & Solutions

Challenge 1: Copilot CLI isn't always in PATH
Solution: Use full path (~/.local/bin/copilot) or check multiple locations

Challenge 2: Response format inconsistency
Solution: Always parse with fallbacks. If JSON fails, show the raw text to the user

Challenge 3: Rate limits and tokens
Solution: Used conservative prompts, cache repo state, batch operations

What I'd Tell Other Builders

  1. Don't just wrap commands — Use Copilot CLI to reason about state and make decisions
  2. Show your work — Let users see what the AI suggested and why
  3. Trust but verify — Copilot CLI is smart, but parse responses defensively
  4. Context > cleverness — A simple prompt with good context beats a clever prompt with no context
  5. Make it fast — Use --silent mode and stream output when possible

The Impact

Since publishing Hermes:

  • Time saved: Users report 10-15 hours/month saved vs raw Git
  • Confidence boost: Devs try advanced Git features they avoided before
  • Learning tool: New developers learn Git concepts through explanations
  • Team alignment: Shared config means everyone follows the same patterns

The GitHub Copilot CLI isn't just powering Hermes — it's making Git accessible to everyone, from juniors to seniors.


Try It Yourself

  npm install -g hermes-git
  cd your-git-repo
  hermes init
  hermes plan "sync my branch safely"
Enter fullscreen mode Exit fullscreen mode

Would love feedback, issues, or contributions: https://github.com/simandebvu/hermes-cli

Let's make Git less scary, together. 🪽

Top comments (2)

Collapse
 
harsh2644 profile image
Harsh

This sounds awesome! 🙌 Definitely going to try Copilot CLI to make Git less intimidating.

Collapse
 
seshanpillay profile image
Seshan Pillay

Awesome 🥳