this post was submitted on 30 Jul 2024
9 points (76.5% liked)
Git
2903 readers
1 users here now
Git is a free and open source distributed version control system designed to handle everything from small to very large projects with speed and efficiency.
Resources
Rules
- Follow programming.dev rules
- Be excellent to each other, no hostility towards users for any reason
- No spam of tools/companies/advertisements. It’s OK to post your own stuff part of the time, but the primary use of the community should not be self-promotion.
Git Logo by Jason Long is licensed under the Creative Commons Attribution 3.0 Unported License.
founded 1 year ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
view the rest of the comments
I do like worktrees when I need to jump back and forth between branches quite a lot, but for the scenario in the video, i.e. quickly doing a hotfix, I often find them too heavyweight.
You don't have the build caches anymore when you create a new worktree, so especially when the project has long build times, you'll be waiting some minutes until you can do your very quick hotfix. Of course, on the plus side, you can leave that to compile and continue working on your non-hotfix branch until it's ready.
What I particularly don't like about stashes, which can also happen with worktrees, is that I forget about them. You just get side-tracked for a moment and two weeks later you realize you still had some code somewhere that you never continued working on.
So, especially when I'm mostly working alone on a branch, I like to just create a WIP commit, push it, and then do the hotfix. If anyone needs to pick up from where I left it, they can at least try to complete that commit.