Skip to content

suhailroushan13/gitai

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

18 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

GitAI Banner

gitai

AI-Powered Git CLI

Commit, push, branch, stash, undo and more β€” with AI-generated commit messages, PR descriptions, security scans, and a built-in Git reference.

npm version license GitHub stars


Installation β€’ Uninstall β€’ Setup β€’ Usage β€’ Features β€’ Docs β€’ Contributing β€’ License


GitAI Demo



πŸ“¦ Installation

Prerequisites

Make sure you have these installed:

Tool Check Install
Git git --version git-scm.com
Node.js (>=16) node -v nodejs.org
jq jq --version brew install jq / sudo apt install jq
curl curl --version Pre-installed on most systems

Install with npm

npm install -g @suhailroushan/gitai

Install with pnpm

pnpm add -g @suhailroushan/gitai

Install with yarn

yarn global add @suhailroushan/gitai

Install from source

git clone https://github.com/suhailroushan13/gitai.git
cd gitai
npm install -g .

Uninstall

To remove GitAI from your system, use the same package manager you used to install:

# npm (default with nvm; binary often in ~/.nvm/versions/node/*/bin/)
npm uninstall -g @suhailroushan/gitai

# pnpm
pnpm remove -g @suhailroushan/gitai

# yarn
yarn global remove @suhailroushan/gitai

If you're not sure which one is active, run which gitai β€” if the path contains nvm, use npm; if it contains pnpm, use pnpm. If you installed with more than one manager, run the matching uninstall for each.

If you installed from source with npm install -g ., run npm uninstall -g @suhailroushan/gitai from any directory.


Verify installation

gitai --help

You should see:

  gitai β€” AI-powered Git CLI
  Usage: gitai [option]

  Options:
    --docs, -d, docs   Show full Git reference (setup, SSH, commands)
    --help, -h         Show this help

  With no options, starts the interactive menu.



πŸ”§ Setup

1. Get a DeepSeek API Key

GitAI uses DeepSeek AI to generate commit messages, PR descriptions, and more.

  1. Go to platform.deepseek.com
  2. Sign up or log in
  3. Navigate to API Keys and create a new key
  4. Copy the key (starts with sk-)

2. Add the API Key to your shell

For zsh (default on macOS):

echo 'export DEEPSEEK_API_KEY="sk-your-key-here"' >> ~/.zshrc
source ~/.zshrc

For bash:

echo 'export DEEPSEEK_API_KEY="sk-your-key-here"' >> ~/.bashrc
source ~/.bashrc

Verify it's set:

echo $DEEPSEEK_API_KEY

3. Configure Git (if not already done)

git config --global user.name "Your Name"
git config --global user.email "your.email@example.com"
git config --global init.defaultBranch main

4. Set up SSH Keys (recommended)

SSH keys let you push/pull without entering your password every time.

Generate a new Ed25519 key:

ssh-keygen -t ed25519 -C "your.email@example.com"
  • Press Enter to accept the default path (~/.ssh/id_ed25519)
  • Optionally set a passphrase

Start the SSH agent and add your key:

eval "$(ssh-agent -s)"
ssh-add ~/.ssh/id_ed25519

Copy the public key:

# macOS
pbcopy < ~/.ssh/id_ed25519.pub

# Linux
cat ~/.ssh/id_ed25519.pub

Add to GitHub:

  1. Go to GitHub β†’ Settings β†’ SSH and GPG keys
  2. Click New SSH key
  3. Paste your key, give it a title, and click Add SSH key

Test the connection:

ssh -T git@github.com

You should see: "Hi username! You've successfully authenticated..."




πŸš€ Usage

Start the interactive menu

gitai

Quick commands

Command Description
gitai Launch interactive menu
gitai --docs Show full Git reference & notes
gitai docs Same as above
gitai -d Same as above
gitai --help Show help
gitai -h Same as above

First commit workflow

# Create a project
mkdir my-project && cd my-project
git init

# Write some code...

# Launch gitai
gitai

# Choose option 1 β†’ AI Commit & Push
# GitAI will:
#   1. Stage all changes (git add .)
#   2. Generate an AI commit message from your diff
#   3. Commit with the message
#   4. Push to origin



✨ Features

29 commands organized into 7 categories:


πŸš€ Commit & Push

# Command Description
1 AI Commit & Push Auto-generate a semantic commit message using AI and push
2 Manual Commit & Push Write your own message, commit, and push
3 Stage All & Status git add . + git status
4 Force Push Overwrite remote (with confirmation)

πŸ”„ Sync & Branches

# Command Description
5 Pull & Rebase Fetch + replay your commits on top
6 Pull & Merge Fetch + merge commit
7 List Branches All local + remote branches
8 Create & Switch Branch git checkout -b <name>
9 Switch Branch git checkout <name>
10 Delete Branch Local and/or remote (prevents deleting current branch)

πŸ“œ History & Diff

# Command Description
11 Git Log Pretty graph of recent 25 commits
12 Show Diff Staged, unstaged, or vs last commit
13 Git Status Full working tree status
14 List Tags All tags (newest first)
15 Search Commits Grep through commit messages

πŸ“¦ Stash & Undo

# Command Description
16 Stash Changes Save work temporarily
17 Pop Stash Restore stashed changes
18 List Stashes See all stash entries
19 Undo Last Commit Soft reset (keeps changes staged)
20 Discard All Changes Hard reset to last commit (with confirmation)

πŸ€– AI Tools

# Command Description
21 AI Explain Last Commit Plain-English summary of what changed
22 AI Suggest Branch Name Generate a branch name from your diff
23 AI Generate PR Description Full PR write-up from recent commits
24 AI Security Scan Diff Spot hardcoded secrets, API keys, and vulnerabilities

βš™οΈ Config

# Command Description
25 Show Git Config Name, email, editor, remotes
26 List Remotes All remote URLs
27 Add Remote Add a new remote
28 Refresh Re-fetch and redraw screen

πŸ“– Docs

# Command Description
29 Git Docs Full Git reference with examples (also via gitai --docs)



πŸ“– Built-in Docs

GitAI ships with a comprehensive built-in Git reference. Access it anytime:

gitai --docs

The docs cover:

Section Topics
Install Git macOS, Ubuntu/Debian, Windows
Global Config user.name, user.email, init.defaultBranch, core.editor, aliases
SSH Key Setup ssh-keygen, ssh-agent, adding key to GitHub, testing
First Repo git init β†’ first commit β†’ add remote β†’ push
Clone HTTPS and SSH
Daily Workflow status, diff, add, commit, push, pull, branches, undo, stash, log, remotes, tags
Config Options pull.rebase, push.autoSetupRemote, fetch.prune, aliases
Conventional Commits feat, fix, docs, style, refactor, test, chore



πŸ–₯️ Screenshots

AI Commit & Push

GitAI AI Commit



AI Security Scan

GitAI Security Scan



Built-in Docs

GitAI Docs



πŸ—‚οΈ Project Structure

gitai/
β”œβ”€β”€ bin/
β”‚   └── gitai.sh          # Main CLI script
β”œβ”€β”€ assets/
β”‚   β”œβ”€β”€ gitai-banner.jpg
β”‚   β”œβ”€β”€ gitai-demo.png
β”‚   β”œβ”€β”€ gitai-ai-commit.png
β”‚   β”œβ”€β”€ gitai-docs.png
β”‚   └── gitai-security-scan.png
β”œβ”€β”€ package.json
β”œβ”€β”€ LICENSE
└── README.md



🀝 Contributing

Contributions are welcome!

# Fork and clone
git clone https://github.com/<your-username>/gitai.git
cd gitai

# Make it executable
chmod +x bin/gitai.sh

# Link it globally for testing
npm link

# Make your changes...

# Test locally
gitai

# Create a PR



πŸ“ License

MIT β€” Made with ❀️ by Suhail Roushan



Star this repo if you find it useful!


Stars

About

Commit, push, branch, stash, undo and more with AI-generated commit messages, PR descriptions, security scans, and a built-in Git reference.

Topics

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages