@forceuser/git-profile-switcher
v0.2.0
Published
CLI and TUI for automatic per-directory Git user identity switching.
Readme
Git Profile Switcher
gip helps you use the right Git identity in the right directory.
It stores named profiles, writes Git includeIf rules for directory-based switching,
and can show the active profile in your shell prompt.
Install
npm install -g @forceuser/git-profile-switcherAfter installation, the CLI is available as both:
gip --help
gip --version
git-profile-switcher --helpQuick Start
Create your profiles:
gip profile:add personal
gip profile:add work --user-name "Work Name" --user-email [email protected]Bind a profile to the current directory:
cd ~/Projects/work-app
gip bind workFrom now on, Git uses that profile in this directory and its Git repositories.
Check what Git identity is active:
gip doctorDaily Use
Pick from your saved profiles:
gip bindSet a global fallback identity:
gip bind personal --globalClear the current directory rule:
gip clearClear the global fallback identity:
gip clear --globalOpen the terminal UI:
gip tuiSession-Only Identity
Use use when you want a profile only in the current terminal session:
gip install:shell zsh
source ~/.zshrc
gip use work
gip use --clearWithout shell integration, use:
eval "$(gip use work --exports)"Shell Prompt
Install prompt integration to show the active profile in your prompt:
gip install:prompt zsh
source ~/.zshrcChoose prompt colors per profile:
gip profile:color work cyanInstall completion, session wrapper, and prompt integration together:
gip install:all zshSupported shells: zsh, bash, and fish.
Move To A New Machine
Export profiles:
gip exportImport profiles on another machine:
gip importBy default, both commands use:
~/gip-profiles.jsonDirectory rules are machine-specific, so gip skips them by default. Include them only
when you explicitly want to migrate the same directory mappings:
gip export --rules
gip import --rulesWhere Data Lives
Profile metadata:
~/.config/git-profile-switcher/Generated Git config snippets:
~/.config/git-profile-switcher/gitconfigs/gip manages one marked block in your global Git config and leaves unrelated content
alone.
Useful Commands
gip bind work ~/Projects/work-app
gip profile:list
gip profile:remove work
gip rule:list
gip rule:add work ~/Projects/work-app
gip rule:remove <rule-id>
gip paths
gip prompt
gip version
gip help <command>For development and release notes, see Development.
