Tag: git

Blog Posts

I Made a Lightweight Git Worktree Manager (Because I Couldn't Find One)

I built a git worktree manager because I couldn't find a simple one.

The problem hit me running two AI coding agents at once. One was refactoring accessibility code while I read the current implementation to chase a bug. Same files, different contexts. Committing the half-done work wasn't an option, stashing would have wiped the agent's state, and I had no clean checkout to review against.

Git worktrees solved that, but the syntax was awkward. Branchyard is great if you want VS Code integration and git hooks. I wanted something I could drop in my dotfiles and read end to end in 20 minutes.

So I built gwt (git-worktree-utils): • bash, zero dependencies • Source-based, lives in ~/.config • One branch = one directory (keeps the mental model simple) • Built-in cleanup for orphaned directories

Use cases beyond AI agents: • Code review without losing your place • Emergency hotfixes without stashing • Running tests in one branch while coding in another

Multiple branches in separate directories, and switching costs a cd instead of a stash. Nothing to unwind, the IDE stays put, and the two contexts never touch.

Project: https://github.com/jamesfishwick/git-worktree-utils

Let the System Remember: Multiple Git Accounts

Spent an hour last week reverse-engineering my own Git multi-account setup. Two ways to keep work and personal apart. The SSH host-alias version uses made-up hostnames. Push from the wrong account and it dies right away on a name that doesn't resolve. The env-var version is neater and never says a word, which is how my personal email ends up on a work commit. I went with the one that trips me at the door, because I'm the part of this that forgets.