logoalt Hacker News

turadgtoday at 2:27 AM0 repliesview on HN

Git worktrees are awesome but they broke my workflow in a couple ways:

Resuming work. I used to `j <reponame>` then `gco <branchname>`. Now if I do that I get an error about the branch being checked out already in another worktree. I realized the branch names are pretty unique across repos so I made ` jbr <branchname>` that works from anywhere.

Jumping within repo. The other kink was when I wanted to focus on a particular package I’d do `j <subdir>` and it would usually be unique enough to jump to the one in my current checkout. But now I have dozens of concurrent checkouts and have to pick, even though I’m already in the repo. So `jd <subdir>` does like autojump or zoxide but only within the current checkout.

To power those shell functions I made a “where” extension for Git.

https://github.com/turadg/git-where

It’s working out nicely!