9
submitted 3 months ago by ruffsl@programming.dev to c/git@programming.dev
top 3 comments
sorted by: hot top controversial new old
[-] embed_me@programming.dev 6 points 3 months ago

TLDW; Use worktrees instead of stashes.

A bad take though, depends on your needs

[-] Ephera@lemmy.ml 5 points 3 months ago

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.

[-] ruffsl@programming.dev 2 points 3 months ago

I hope compatibility with git submodules gets ironed out soon. I'd really like to have multiple branches of a superproject checked out at once to make it simpler to compare source trees and file structures.

this post was submitted on 30 Jul 2024
9 points (76.5% liked)

Git

2634 readers
5 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

  1. Follow programming.dev rules
  2. Be excellent to each other, no hostility towards users for any reason
  3. 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