Skip to content

Latest commit

 

History

History
154 lines (107 loc) · 3.08 KB

File metadata and controls

154 lines (107 loc) · 3.08 KB

git-persona

Manage multiple Git identities with ease. Switch between work, personal, and client personas with automatic gitconfig management and visual prompt feedback.

Features

  • 🎭 Multiple named personas with different Git identities
  • 🔑 Per-persona SSH keys and GPG signing
  • 🎨 Colored shell prompt showing active persona
  • 📁 Apply personas to directories with automatic includeIf management
  • 🐚 Shell completion for bash, zsh, and fish

Installation

From releases

Download the latest release for your platform from the releases page.

From source

cargo install --git https://github.com/uRadical/git-persona

Shell integration

Add to your shell config:

# Bash (~/.bashrc)
eval "$(git-persona init bash)"

# Zsh (~/.zshrc)
eval "$(git-persona init zsh)"

# Fish (~/.config/fish/config.fish)
git-persona init fish | source

Usage

Add personas

# Interactive
git-persona add

# Non-interactive
git-persona add work -n "Alan" -e "alan@company.com" -c blue
git-persona add personal -n "Alan" -e "alan@home.com" -c green -k ~/.ssh/personal

Apply to a directory

cd ~/code/work-project
git-persona apply work
# ✓ Created ~/code/work-project/.gitconfig
# ✓ Updated ~/.gitconfig (backup: ~/.gitconfig.bak)

This creates a local .gitconfig and adds the appropriate includeIf to your global config.

List personas

git-persona list
#   personal (green)
# * work (blue)         ← current

git-persona list --all
#   work (blue)
#     ~/code/work-project
#     ~/code/client-a
#
#   personal (green)
#     ~/code/oss

Check current persona

git-persona status
# work

git-persona which
# Persona
#   Name:  work
#   Color: blue
#
# Git Config
#   user.name:  Alan
#   user.email: alan@company.com
#   core.sshCommand: ssh -i ~/.ssh/work -o IdentitiesOnly=yes

Shell prompt

With shell integration, your prompt shows the active persona in its assigned color:

~/code/work-project [work]$     ← blue
~/code/personal [personal]$     ← green  
~/tmp$                          ← no tag

Remove personas

# Remove from current directory
git-persona unapply

# Delete a persona (blocked if in use)
git-persona rm work
# Error: persona 'work' is in use at 2 location(s)

# Force delete (removes from all locations)
git-persona rm work --force

Edit personas

git-persona edit work
# Interactive prompts to modify fields

Git subcommand

Since the binary is named git-persona, Git automatically recognizes it as a subcommand:

git persona list
git persona apply work
git persona status

Configuration

Config is stored at ~/.config/git-persona/config.json (respects XDG_CONFIG_HOME).

Available colors

black, red, green, yellow, blue, magenta, cyan, white

Bright variants: bright-red, bright-green, etc.

Background

This project supersedes gitorgs, rewritten in Rust for improved performance and reliability.

License

MIT