gg is a high-level Git workflow automation tool written in Rust. It’s designed for developers who want the power of Git without the cognitive overhead of managing rebases, upstream tracking, or conventional commit formatting manually.
- Intuitive Remotes:
gg remote <url>doesn't just set a string; it fetches, tracks, and automatically rebases unrelated histories (perfect for syncing local-first projects with new GitHub repos). - Smart Saving:
gg saveanalyzes your diffs to generate Conventional Commits (e.g.,feat(main.rs): added file) automatically. - Fail-Fast Safety: Prevents destructive operations if your working directory is dirty.
- Automated Workflows:
feature: Syncs main, branches out, and sets up tracking in one go.done: Merges, cleans up, and returns you to safety.
- Smart Auth: Transparently handles SSH Agents, disk-based SSH keys (
RSA,ED25519), and HTTPS Credential Helpers.
graph TD
Start((<b>Start</b>)) --> Creds["<b>gg creds</b><br/>Set identity"]
Creds --> Remote["<b>gg remote</b><br/>Link & Sync history"]
Remote --> Main[<b>Main Branch</b>]
Main --> Feature["<b>gg feature</b><br/>Branch out"]
Feature --> Code[<i>Edit Files</i>]
Code --> Save["<b>gg save</b><br/>Auto-commit & Push"]
Save -- "Still working?" --> Code
Save -- "Review?" --> PR["<b>gg pr --open</b><br/>Open Pull Request"]
PR --> Done
Save -- "Finished?" --> Done["<b>gg done</b><br/>Merge & Clean up"]
Done --> Main
%% Error Handling
Save -. "Conflict" .-> Fix[<i>Manual Fix</i>]
Fix -. "Retry" .-> Save
style Creds fill:#f5f5f5,stroke:#333
style Remote fill:#f5f5f5,stroke:#333
style Save fill:#bbf,stroke:#333
style PR fill:#ff9,stroke:#333
style Done fill:#bfb,stroke:#333
style Fix fill:#f66,stroke:#333
gg creds "Your Name" "email@example.com" --global- Start a project and link it
Instead of fighting with --allow-unrelated-histories:
git init
gg save -m "Initial work"
gg remote git@github.com:user/repo.git- Save your work
# Automatically generates: feat: added 3 files (+12, -0, ~0)
gg save
# Or see what it would do:
gg save --dry-run- Create a Pull Request
# Output the link to stdout
gg pr
# Or open it directly in your browser
gg pr --open🛠 Commands
| Command | Description |
|---|---|
| pull | Pulls from the remote |
| push | Pushes to the remote |
| features | Lists all branches |
| feature -n | Pulls latest, switches to a new branch, and pushes upstream. |
| save [-m msg] | Pulls, stages all, commits (auto-conventional), and pushes. |
| pr [--open] | Generates - and optionally opens - a link to create a PR on the appropriate service, if any |
| done [--no-clean] | Switches to main, pulls, and deletes the feature branch. |
| remote | Sets remote and performs an auto-rebase sync of histories. |
| config | Sets Git user.name and user.email. |
When you run gg remote, the tool performs a specialized sync:
- It fetches the remote state.
- It detects if the local and remote histories are unrelated.
- It rebases your local commits onto the remote's HEAD.
- It sets up upstream tracking so you never have to type git push -u origin main again.
GPLv3