A cross-platform CLI tool for managing multiple Git user profiles and SSH keys.
- Multiple Git identities per project or remote URL
- SSH key configuration generation with alias auto-resolution
- YAML configuration with nginx-style include support
- Shell completion for bash, zsh (with Tab/Shift+Tab menu), and PowerShell
- cd-auto-switch shell hook (also triggers on shell startup)
- Pre-commit hook to verify correct identity before each commit
- Cross-platform support for Linux, macOS, and Windows
- Project templates for quick setup
Download from GitHub Releases:
# macOS (Apple Silicon)
curl -LO https://github.com/Sylphy-Greyrat/git-switch/releases/download/v0.1.0/git-switch-v0.1.0-aarch64-macos
chmod +x git-switch-v0.1.0-aarch64-macos
sudo mv git-switch-v0.1.0-aarch64-macos /usr/local/bin/git-switch
# macOS (Intel)
curl -LO https://github.com/Sylphy-Greyrat/git-switch/releases/download/v0.1.0/git-switch-v0.1.0-x86_64-macos
chmod +x git-switch-v0.1.0-x86_64-macos
sudo mv git-switch-v0.1.0-x86_64-macos /usr/local/bin/git-switch
# Linux (x86_64)
curl -LO https://github.com/Sylphy-Greyrat/git-switch/releases/download/v0.1.0/git-switch-v0.1.0-x86_64-linux
chmod +x git-switch-v0.1.0-x86_64-linux
sudo mv git-switch-v0.1.0-x86_64-linux /usr/local/bin/git-switchgo install github.com/sylphy/git-switch/cli@latest| Dependency | Version | Required for |
|---|---|---|
| Git | 2.5+ | core.hooksPath (2.5), git remote get-url (2.0), git -C (1.8.5), git config --local (1.7) |
| Go | 1.22+ | Only for go install builds (binary downloads have no Go dependency) |
# Initialize configuration
git-switch init
# Edit your profile
vim ~/.config/git-switch/profiles/personal.yaml
# Install shell hook and completion
git-switch hook install
# Use it!
git-switch status
git-switch profile list| Command | Description |
|---|---|
init |
Initialize configuration directory |
profile list |
List all profiles |
profile show <name> |
Show profile details |
profile add <name> |
Add a new profile |
profile remove <name> |
Remove a profile |
profile current |
Show current active profile |
profile edit <name> |
Edit profile in default editor |
profile use <name> |
Set active profile for current directory |
run |
Run a git command under the matched profile |
status |
Show current configuration status |
rule list |
List all matching rules |
rule add |
Add a matching rule to a profile |
rule remove |
Remove a matching rule |
rule test <path> |
Test directory matching |
ssh config |
Regenerate SSH config |
hook install |
Install shell hook and completion |
hook uninstall |
Remove shell hook and completion |
hook status |
Show hook and completion installation status |
completion <shell> |
Generate shell completion script |
template list |
List project templates |
template create |
Create a new project template |
template apply |
Apply template to project directory |
uninstall |
Uninstall git-switch and remove the binary |
--version |
Show version |
Configuration is stored in ~/.config/git-switch/:
~/.config/git-switch/
├── config.yaml # Main configuration
└── profiles/
├── personal.yaml # Personal profile
└── work.yaml # Work profile
See docs/USAGE.md for detailed usage instructions.