ggid-0.2.0 is not a library.
gid - Git Identity Manager
✨ Features
- 🚀 One-click Switch - Quickly switch between multiple Git identities
- 📋 Smart Rules - Automatically match identities based on path or remote URL
- 🔑 SSH Integration - Automatically configure SSH keys and ssh-agent
- 🔏 GPG Signing - Support commit signing key management
- 🪝 Git Hooks - Automatically check identity before commit
- 📊 Audit - Check for identity issues in commit history
- 🌍 Cross-platform - Native support for Linux, macOS, and Windows
- ⚡ High Performance - Written in Rust, extremely fast startup
📦 Installation
Build from Source
# Clone repository
# Install
# Or build release
Download Binary
Download binaries for your platform from the Releases page.
🚀 Quick Start
1. Add Identity
# Interactive add
# Or specify arguments
# Or use short flags
2. Switch Identity
# Switch identity for current project
# Switch global identity
3. Set Rules (Auto Switch)
# Add path rule
# Add remote URL rule
# Apply rules automatically
4. Install Git Hook
# Install to current repository
# Or install globally
📖 Usage
gid - Git Identity Manager
Usage: gid <COMMAND>
Commands:
switch Switch to a specified identity [aliases: sw]
list List all identities [aliases: ls]
current Show current identity [aliases: c]
add Add a new identity
remove Remove an identity [aliases: rm]
edit Edit configuration file
export Export configuration
import Import configuration
rule Manage rules
doctor Check identity configuration in current directory
auto Automatically switch identity based on rules
hook Manage Git hooks
audit Audit identity information in commit history
fix-commit Fix identity information in commits
completions Generate shell completion scripts
Options:
-h, --help Print help
-V, --version Print version
Identity Management
# List all identities
# Show current identity
# Add identity (interactive)
# Add identity (with SSH and GPG)
# Using short flags
# Remove identity
Rule Management
# Add path rule
# Add remote URL rule
# List all rules
# Test rule matching
# Remove rule
Check and Auto Switch
# Check identity configuration in current directory
# Auto fix
# Auto switch based on rules
Git Hooks
# Install pre-commit hook (current repo)
# Install global hook
# Check hook status
# Uninstall hook
Audit
# Audit current repository
# Audit specified directory
Fix Commits
# Fix identity in the most recent commit
# Fix a specific commit
# Fix using a specific identity
# Batch fix a range of commits
# Fix without confirmation prompts
⚙️ Configuration
Configuration File Location
- Linux/macOS:
~/.config/gid/config.toml - Windows:
%APPDATA%\gid\config\config.toml
Can be customized via GID_CONFIG_DIR environment variable.
Configuration Format
# Identity List
[[]]
= "work"
= "John Doe"
= "john@company.com"
= "Work Identity"
= "~/.ssh/id_work"
= "ABCD1234"
= true
[[]]
= "personal"
= "John Doe"
= "john@gmail.com"
= "Personal Identity"
# Rule List
[[]]
= "path"
= "~/work/**"
= "work"
= 100
[[]]
= "remote"
= "github.com/my-company/*"
= "work"
= 50
# Settings
[]
= true
= true
= false
= true
= false
Project Config (.gid)
Create a .gid file in the project root to specify the default identity:
work
Environment Variables
| Variable | Description | Default |
|---|---|---|
GID_COLOR |
Enable/disable color output | true |
NO_COLOR |
Disable color output (standard) | - |
GID_VERBOSE |
Enable verbose output | from config |
GID_EDITOR |
Editor for gid edit |
EDITOR |
GID_CONFIG_DIR |
Custom config directory | - |
📚 Advanced Documentation
For detailed information about advanced features, see:
- SSH Integration - SSH key management, ssh-agent, config
- GPG Signing - GPG key management and commit signing
- Git Hooks - Pre-commit hooks, bypass options
🐚 Shell Completion
# Bash
# Zsh
# Fish
# PowerShell
🔧 Development
Build
# Debug mode
# Release mode
# Run tests
Directory Structure
src/
├── main.rs # Entry point
├── cli.rs # CLI definition
├── commands/ # Command implementations
├── config/ # Configuration management
├── rules/ # Rule engine
├── git/ # Git operations
├── ssh/ # SSH management
├── gpg/ # GPG management
└── audit/ # Audit functionality
🤝 Contributing
Contributions are welcome. Please open an issue or submit a PR.
📄 License
MIT License - see LICENSE file.