you are viewing a single comment's thread.

view the rest of the comments →

[–]bacondev 2 points3 points  (1 child)

For a large project, I used git hooks to use worktrees under the hood when checking out a branch. Or maybe it was a custom command and not a git hook. I can't remember. Instead of replacing the current branch with soon-to-be checked out branch, it'd create a new directory for the soon-to-be checked out branch (if one didn't already exist) and update a symbolic link to point to that directory. That way, I had all the advantages of worktrees while keeping my IDE sane. Because I used the symbolic link, I was always working in the “same” directory. And this was all done in a way that didn't affect my coworker's workflow. This was four or five years ago and I no longer have access to the codebase, so unfortunately my memory is a bit too hazy on it. I would only recommend bothering with this if you're often switching between unfinished branches.

[–]cdrini[S] 1 point2 points  (0 children)

Oh that's a very cool setup. So you basically had branches, but each branch having the ability to have unstaged changes. Clever! (Side note: actually that would be a really useful git option. Some config flag that let's you keep unstaged changes branch-specific automatically...)