Pidan is a lightweight Git helper that enhances workflow efficiency by providing convenient utilities such as AI-generated commit messages, easy .gitignore management, repository export tools, and more.
Pidan is designed to be simple, predictable, and consistent across all commands.
Features
- Initialize a personal Pidan environment (
pidan init) - Manage project
.gitignorefiles using your global template - Export a clean snapshot of a Git repository (
pidan export) - Generate commit messages using AI (
pidan commit) - Configure global AI model + API key (
pidan ai) - Built-in version checking (
pidan --upgrade) - Display environment and binary info (
pidan --info)
Installation
curl https://pidan.binhua.org/install | bash
This installs the pidan binary into ~/.local/bin (or other appropriate location depending on your system).
Usage
USAGE:
pidan [global options] command [command options] [arguments...]
Commands
pidan init
Initialize the Pidan environment under:
~/.pidan/
own.gitignore
config_ai.json
Must be run once after installation.
pidan gitignore
Create or modify .gitignore in the current directory using your template:
~/.pidan/own.gitignore
- If no
.gitignoreexists → create one - If exists → choose:
- Append
- Overwrite
- Cancel
pidan export [ref]
Export a clean snapshot of the repository at a specific Git revision.
Examples:
pidan export # Export HEAD
pidan export main # Export branch "main"
pidan export a7e23f1 # Export specific commit
Exports to:
./export
.git directory and .gitignore files are excluded.
pidan commit
Generate an AI-powered commit message and commit the staged changes.
Features:
- Auto-stages the entire repo (
git add -A) - Shows AI-generated commit message for confirmation
- Supports OpenAI, Gemini, Grok
Requires AI configuration (see below).
pidan ai
Manage global AI configuration.
Show current configuration:
pidan ai
# or
pidan ai config show
Set provider + model + key:
pidan ai config <provider> <model> <api_key>
Supported providers:
openaigeminigrok
Example:
pidan ai config openai gpt-5 sk-xxxx
Remove AI configuration:
pidan ai config unset
Global Options
--info
Show environment details:
- Pidan version
- Config path
- AI config status
- Executable path
pidan --info
--upgrade
Check for newer Pidan versions:
pidan --upgrade
Does not auto-install updates; only reports availability.
--help, -h
Show help message.
pidan --help
Directory Structure
After running pidan init:
~/.pidan/
own.gitignore # Your ignore template
config_ai.json # AI provider/model/key
Example Workflow
pidan init
vim ~/.pidan/own.gitignore
pidan gitignore
pidan ai config openai gpt-5 sk-xxxx
git add .
pidan commit