Git Workflows
Managing Multiple Git Identities Without Losing Context
Somewhere between your third client and your first open-source contribution under a different email, you stop trying to remember which identity a repository needs — and start looking for a system instead.
The wall everyone hits eventually
A single Git identity is fine right up until it isn't. The moment you have a work account and a personal one, or a handful of clients each expecting commits under their own email, Git's single global user.name / user.email stops matching reality. The common workaround — a local git config user.email in every repo, run once and never thought about again — works until you clone a new repo and forget the step, or copy a config from the wrong project.
The failure mode is quiet. Nothing errors. You just end up with a commit under the wrong name in a history you can't rewrite, discovered days later by someone else.
Identity is more than name and email
The local config trick also only solves one third of the problem. Your identity to Git includes what appears on the commit, but authenticating as that identity involves two more moving parts:
- An SSH key — if the wrong key is active, the push fails or, worse, succeeds as the wrong account.
- An HTTPS credential — same risk over HTTPS, where Git's credential helper hands over whatever it has cached.
Fixing only the commit email while the SSH key or credential still belongs to a different account doesn't solve the problem — it just moves it somewhere less visible.
What context-switching should feel like
The fix isn't discipline, it's not having to remember at all. In GitPersona, a profile bundles name, email, signing key, SSH key, and HTTPS credential as one unit. You bind it to a repository once — or let a rule match it automatically by path, remote host, or owner — and every piece of the identity switches together from then on.
That's the actual shift: instead of three settings you have to keep in sync by hand across every repository, it's one profile that repositories point to. Add a fourth client and you add one profile, not three settings times every existing repo you touch.
The safety net for when you forget anyway
Even with profiles and rules doing the routing, it's worth having a check at the moment it matters most. Commit Guard is an optional pre-commit hook that compares the identity a commit is about to use against the repository's expected profile, and warns — or blocks — on a mismatch. It doesn't replace getting the identity right in the first place; it catches the case where something changed by hand and nobody noticed.
Managing multiple Git identities isn't really about remembering harder. It's about giving the thing you'd otherwise have to remember a place to live.