avatar vian's notes

Learning in public, one post at a time

  • HOME
  • TAGS
  • ARCHIVES
  • ABOUT
Home How I Stopped Committing as the Wrong Person
Post

How I Stopped Committing as the Wrong Person

Posted Oct 17, 2026 Updated Aug 24, 2026
By Alvian
3 min read
How I Stopped Committing as the Wrong Person
How I Stopped Committing as the Wrong Person

The Wrong Name in the Log

A few days ago my laptop broke — some keyboard keys stopped working — so the office swapped it for a spare. Re-setting up my workspace meant SSH keys, dotfiles, git config, the lot. Somewhere in that re-setup, git’s identity fell through the cracks.

The proof showed up in the log: every commit I’d made since the swap said the same thing — my new laptop’s username. Not my GitLab handle. Not my GitHub handle. Just the local account I logged into macOS with.

Nothing was broken — the commits pushed fine. But it didn’t look clean, and in any shared repo, the author field is the artifact you leave behind. I keep two identities: a GitLab work account (alvian.r.hanif / alvian.hanif@pasarpolis.com) and a GitHub account (vianhanif / alvian524@gmail.com). I’d never had to think about this before — the swap forced me to rebuild my setup, and it made the problem visible.

The stakes were simple: I didn’t want work commits carrying the wrong identity, and I didn’t want to scrub git history later — rewriting history is a one-way door. I wanted to make the mistake impossible, not just less likely.

Routing by Directory

My projects already lived in two groups — ~/Documents/work/ and ~/Documents/personal/ — and I could split each further by host: gitlab, github. So instead of configuring git per repository, I configured it per directory using conditional includes in my global ~/.gitconfig.

I created two identity files, one per account:

1
2
3
4
# ~/.gitconfig-gitlab
[user]
    name = alvian.r.hanif
    email = alvian.hanif@pasarpolis.com
1
2
3
4
# ~/.gitconfig-github
[user]
    name = vianhanif
    email = alvian524@gmail.com

Then I wired them into the main config:

1
2
3
4
5
6
7
8
[includeIf "gitdir:~/Documents/work/gitlab/"]
    path = ~/.gitconfig-gitlab

[includeIf "gitdir:~/Documents/work/github/"]
    path = ~/.gitconfig-github

[includeIf "gitdir:~/Documents/personal/github/"]
    path = ~/.gitconfig-github

Three directories, two files — my GitHub identity is mine everywhere; the axis that actually mattered was GitLab vs GitHub. Any repo living under one of these trees picks up the matching identity when git looks up its config.

One caveat worth knowing: a per-repo user.name or user.email in a repo’s own .git/config overrides these includes. So the migration had a second half — making sure none of my repos carried a stale local identity. git config user.email shows the effective value; add --show-origin to see where it comes from. (A stricter option: git config --global user.useConfigOnly true, which makes git refuse to guess an identity when none is configured.)

The Migration

I had 13 repositories to sort. I classified each one by its remote (git remote get-url origin):

  • Work (GitLab): five repos
  • Work (GitHub): five repos
  • Personal (GitHub): three repos

I proved the routing first: a throwaway repo in each of the three folders, git config user.email, the right account, delete. Then I moved the real repos into their folders and confirmed each one resolved the same way.

Outcome: Config by Location

Now every repo I clone into those folders inherits the correct identity automatically. No per-repo config, no pre-push ritual. The fix took an afternoon — and it’s the kind of thing I wish I’d done sooner. The visible result is a git history where every commit says what I actually meant it to say.


Sources

  • Git Documentation: Conditional Includes
personal technical
This post is licensed under CC BY-NC 4.0 by the author.
Share

Recently Updated

  • One Trailing Comma, One Wiped Config: A Data-Loss Bug in 9router's OpenCode Writer
  • OpenCode V2: Deciding to Upgrade and the Journey There
  • What Changed in OpenCode V2
  • OpenCode V2 + 9router: 9 Traps in a Custom Provider Setup
  • Your MCP Server Isn't Timing Out. Your Laptop Is Asleep.

Trending Tags

9router technical tooling opencode postmortem ade ai personal warp agents

Contents

Further Reading

Oct 7, 2026

Part 1: Why I Need Analytics for My Personal Blog

I spent my first few months of blogging writing into the void. Hit publish, share the link, and wait—for nothing. No comments, no emails, no signal that anyone had seen the words. It felt like shou...

Oct 21, 2026

Your MCP Server Isn't Timing Out. Your Laptop Is Asleep.

Wrong Layer The MCP gateway to my dev tools kept failing. Status: failed. Error: Request timed out. My agent sessions run overnight, so I didn’t see the failures live — I woke up to a pile of the...

Oct 20, 2026

OpenCode V2: Deciding to Upgrade and the Journey There

I noticed OpenCode quietly published their V2 release. As someone running V1 across multiple machines and workspaces for months, I found myself staring at the announcement and thinking: Do I upgrad...

Older
Saving OpenCode Sessions After Laptop Swap
Newer
When the Dashboard Became Optional

© 2026 Alvian. Some rights reserved.

This blog is open source — view on GitHub

Using the Chirpy theme for Jekyll.

Trending Tags

9router technical tooling opencode postmortem ade ai personal warp agents