gpx
gpx (Git Profile Extension) helps you switch Git/SSH identities between projects.
Install
-
Install from crates.io:
-
Build from source:
What You Can Do
-
Initialize GPX files and bootstrap config:
-
Remove GPX-managed bootstrap/cache/state when needed (and prune empty GPX root dirs):
-
Inspect which profile matches the current directory:
-
Apply the selected profile now:
-
See current status and diagnostics:
-
List available profiles/rules:
-
Run zero-persistence passthrough commands (
gpx gitand no-subcommand mode):
Config Workflow
- Run
gpx initfirst. - If no config exists, GPX creates a commented template
config.tomlfor you. - Edit
config.tomlto define your profiles and matching rules. - Run
gpx checkandgpx applyto verify and activate.
Config Reference
[core].defaultProfile: Requiredno(but required if no rule can match); Defaultunset; Allowedprofile name.[core].ruleMode: Requiredno; Defaultfirst-match; Allowedfirst-match | highest-score.[core].mode: Requiredno; Defaultglobal-active; Allowedglobal-active | repo-local.[hook].fixPolicy: Requiredno; Defaultcontinue; Allowedcontinue | abort-once.[run].allowProfileOverride: Requiredno; Defaultfalse; Allowedtrue | false.[worktree].allowSharedFallback: Requiredno; Defaultfalse; Allowedtrue | false.[ssh].dynamicMatch: Requiredno; Defaultfalse; Allowedtrue | false.[rule.<name>]: Requiredyesfor automatic switching;profileis required and at least one matcher is required frommatch.path | match.remoteHost | match.remoteOrg | match.fileExists.
Hook installation is command-driven (gpx hook install/uninstall ...) and no longer uses config toggles like hook.shell or hook.git.
Hooks
You can enable automatic profile updates with shell and/or Git hooks.
-
Install shell hook:
-
Install Git hook:
-
Install both:
-
Uninstall hooks:
Supported shells: bash, zsh, fish, nushell, tcsh, elvish.
Command List
gpx init
gpx deinit
gpx doctor
gpx status [--verbose]
gpx list [profiles|rules] [--json]
gpx check [--cwd <path>] [--json]
gpx apply [--cwd <path>] [--profile <name>] [--dry-run]
gpx hook install [--shell bash|zsh|fish|nushell|tcsh|elvish] [--git]
gpx hook uninstall [--shell bash|zsh|fish|nushell|tcsh|elvish] [--git]
gpx git [-p <name>|--profile <name>] -- <git args...>
gpx [-p <name>|--profile <name>] -- <command args...>
Detailed Spec
For full config reference and behavior details, see docs/SPEC.md.