Skip to content

alonsovm44/g

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

g — Git that talks back.

Stop memorizing Git commands. Start telling Git what you want.

Rust License: MIT PRs Welcome crates.io GitHub stars


A CLI wrapper that makes Git feel easier than ever

Install · Quick Start · Commands · Why g? · Demos


The problem: 😱 You just committed your API keys.

You accidentally committed a .env file with all your API keys. Or a 200MB binary. Or both. You Google "how to undo git commit" and get 47 different StackOverflow answers with reset, revert, --soft, --hard, --mixed, HEAD~1, ORIG_HEAD...

With g?

$ g undo

  ⏪ Last action detected:
    💾 Commit: "added environment config"

  Files in this commit:
    .env                 | 12 ++++++
    src/config.rs        | 3 ++-

  What would you like to do?
  > Undo commit, keep all changes staged
    Undo commit, keep changes unstaged
    Undo commit and discard all changes
    Cancel

  ✔ Commit undone.
  Your changes are staged and ready to re-commit.

That's it. No Googling. No panic. Just tell Git what you want.


Install

# With Cargo (Rust toolchain)
cargo install g-cli

# Or build from source
git clone https://github.com/alonsovm44/g.git
cd g
cargo build --release
cp target/release/g /usr/local/bin/  # or C:\Tools\ on Windows
Requirements
  • Git (any modern version)
  • Rust 1.70+ (to build from source)
  • Works on Windows, macOS, and Linux

Quick Start

g                    # Show friendly status (default)
g save "my changes"  # Stage + commit in one step
g undo               # Undo anything, safely
g push               # Push with a preview first

That's the 80% of Git you use daily. Now it takes zero brain power.


📖 Commands

g status — Know where you stand

$ g status

  You're on branch: feature/auth

  Staged changes:
    + src/session.rs

  Unstaged changes:
    ~ src/login.rs
    ? src/tmp.js

  Staged: 1 file(s)  Unstaged: 2 file(s)

  ⚠ You're 3 commit(s) behind remote

  Suggested next steps:
    → g save "describe your changes"
    → g undo  (undo last action)

g save "message" — Commit without the ceremony

Stages everything and commits. One command. One thought.

$ g save "add session handling"

  Staging all changes...
  Creating commit...

  ✔ Commit created:
    "add session handling"

  Files:
    + src/session.rs
    ~ src/login.rs

  You're now 1 commit(s) ahead of origin/feature/auth

g undo — The killer feature ⭐

Undo anything. Commits, merges, pulls, branch switches, rebases — all with a preview of what will happen before it does.

$ g undo

  ⏪ Last action detected:
    💾 Commit: "add session handling"

  Files in this commit:
    src/session.rs       | 45 ++++++++++++
    src/login.rs         | 3 ++-

  What would you like to do?
  > Undo commit, keep all changes staged
    Undo commit, keep changes unstaged
    Undo commit and discard all changes
    Cancel

  ✔ Commit undone.
  Your changes are staged and ready to re-commit.

Undo a branch switch:

$ g undo

  ⏪ Last action detected:
    🔄 Switched from 'main' to 'feature/auth'

  What would you like to do?
  > Switch back to 'main'
    Cancel

  ✔ Switched back to 'main'.

Undo timeline — rewind to any point in your history:

$ g undo --list

  Undo timeline:
  Pick any action to rewind to the state before it.

  > 💾 Commit: "add session handling"          (2 minutes ago)
    🔄 Switched from 'main' to 'feature/auth'  (5 minutes ago)
    💾 Commit: "fix login bug"                  (1 hour ago)
    ⬇️ Pulled from remote                       (2 hours ago)
    🔀 Merged branch 'feature/ui'               (yesterday)

g explain — "What the hell did I just do?"

$ g explain

  Recent actions:

  1)  You committed: "add session handling"
      2 minutes ago

  2)  You switched to branch feature/auth
      5 minutes ago

  3)  You committed: "fix login bug"
      1 hour ago

  Current state:
    ✔ Clean working directory
    On branch: feature/auth
    ↑ 2 commit(s) ahead of remote

g log — Human-readable history

$ g log

  Your recent work:

  🟢 add session handling                (2 hours ago)
  🟢 fix login bug                       (3 hours ago)
  🟢 refactor auth middleware            (yesterday)
  🔵 merge branch 'feature/ui'           (2 days ago)

  Tip: Run `g log --story` to see what changed in plain English

g log --story — Narrate your project

$ g log --story

  Project story:

  You worked on authentication:

    - Refactored middleware to simplify request handling
    - Fixed a bug in login validation
    - Added session handling to persist user state

  Then, you merged branch 'feature/ui' into your current branch.

  Current focus:
    Branch feature/auth — last: "add session handling"

g switch <branch> — Branch without confusion

$ g switch login-fix

  Branch 'login-fix' does not exist.

  Options:
  > Create new branch from current (feature/auth)
    Create from main
    Cancel

  ✔ Created and switched to 'login-fix' (from main)

g whoops "new message" — Fix a typo in your commit

$ g whoops "fix login validation"

  Fixing last commit message...

  Before: "fix loing validaiton"
  After:  "fix login validation"

  ✔ Commit message updated.

g push — Push without anxiety

$ g push

  You're about to push:

    Branch:      feature/auth
    Commits:     3
    Destination: origin/feature/auth

  Summary:
    - add session handling
    - fix login bug
    - cleanup auth flow

  Proceed? (y/n)

  ✔ Pushed 3 commit(s) to origin/feature/auth.

g sync — Pull without fear

$ g sync

  Pulling latest changes from remote...

  ⚠ Merge conflict detected!

  Conflicting files:
    ! src/login.rs

  What would you like to do?
  > Accept incoming changes (theirs)
    Keep your version (ours)
    Abort merge (go back to before sync)

g stash — Named stashes that make sense

g stash save "WIP auth stuff"   # Stash with a name you'll remember
g stash list                    # See all your stashes
g stash pop                     # Pick which stash to restore

g clean — Prune dead branches

$ g clean

  Analyzing branches...

  Safe to delete (already merged):
    - feature/old-login  (last commit 2 weeks ago)
    - test/tmp-api       (last commit 10 days ago)

  Possibly unsafe (not merged):
    ? wip/refactor-auth  (last commit 3 days ago)

  Delete 2 safe branch(es)? (y/n)

  ✔ 2 branch(es) cleaned up.

g map — Visualize your repo

Exports your commit graph as a Graphviz .dot file with a dark theme.

g map                          # → repo-map.dot
g map -o my-graph.dot          # Custom output path
g map --max-commits 100        # Include more history
dot -Tpng repo-map.dot -o repo-map.png  # Render it

🧠 Why g?

Most Git wrappers just alias commands. They don't actually help you understand what's happening.

g is different:

Problem Git g
"What's going on?" git status → wall of text g status → clear summary + next steps
"Save my work" git add -A && git commit -m "..." g save "..."
"I messed up" Google "how to undo git ___" g undo → pick what you want
"What did I just do?" git reflog → cryptic hashes g explain → plain English
"Show my history" git log --oneline → just hashes g log → emoji timeline
"Fix my typo" git commit --amend -m "..." g whoops "..."
"Is it safe to push?" git log origin/branch..HEAD 🤔 g push → preview first
"Clean up branches" Manually check & delete each one g clean → auto-detect safe deletions

g doesn't replace Git. It's the friendly layer on top for the 80% of Git you do every day. Drop to git for the other 20%.


🛠 Built With

  • Rust — fast, single binary, no runtime
  • clap — argument parsing
  • colored — terminal colors
  • dialoguer — interactive prompts

📋 Full Command Reference

Command Description
g / g status Friendly, actionable repo status
g save "msg" Stage all + commit in one step
g undo Undo last action safely with preview
g undo --list Interactive undo timeline
g explain Recent actions in plain English
g log Emoji-tagged commit history
g log --story Narrative project history
g switch <branch> Smart branch switching (creates if needed)
g whoops "msg" Fix last commit message
g push Push with preview + confirmation
g sync Pull with guided conflict resolution
g stash save "msg" Named stash
g stash pop Interactive stash restore
g stash list List all stashes
g clean Prune merged/stale branches safely
g map Export repo graph as Graphviz .dot

🎬 Demos

😱 "You just committed your API keys." ⚡ Your entire daily workflow
g undo saves you in 5 seconds. No Googling. gg saveg push. That's your whole morning.
g undo demo g daily flow demo
🕰️ The Git time machine
It's Friday. Something broke. g undo --list lets you pick any point to rewind to.
g time machine demo

g — because Git shouldn't require a PhD.

⭐ Star this repo if you think Git should be easier.

About

no more git headaches with g

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors