• 0 Posts
  • 20 Comments
Joined 1 year ago
cake
Cake day: June 11th, 2023

help-circle




  • I found basic functioning of worktrees to fail with submodules. The worktree doesn’t know about submodules, and again and again messes up the links to it. Basic pulling, switching branches, …, all of this frequently fails to work because the link to the submodule is broken. I ended up creating the submodules as worktrees of a separate checkout of the submodule repo, and recreating these submodule worktrees over and over. I pretty much stopped using worktrees at that point.

    Have you tried the global git config to enable recursive over sub modules by default?

    Nope, fingers crossed it helps for you ;) Unrelated to worktrees but: in the end I like submodules in theory but found them to be absolutely terrible in practice, that’s without even factoring in the worktrees. So we went back to a monorepo.


  • I’m a C++ dev, I have one checkout of the main repo and 3 worktrees. Switching branches can be expensive because of recompiles, so to do e.g. quick fixes I’ll use worktree 1 where I typically don’t even compile the code, just make the fix and push it to the CI system. Worktrees 2 and 3 I keep at older releases so I can immediately fire up development and one of those releases side by side and compare results as well as the code.

    The cool thing about worktrees instead of multiple checkouts is that you only have one .git folder, so less disk space. But more importantly local branches (well everything actually) are shared, so you can create a local branch in the main checkout, and later come back to it in a worktree. You also don’t need fetching/… in the worktrees, as they share the same .git folder.

    Only thing that I found virtually impossible to work with is worktree + submodules.







  • I read through the better part of a linked thread: https://forum.dlang.org/thread/ncbawciyybdksecurmsc@forum.dlang.org?page=1. And wow, as a C++ user, I’m not sure if I should feel blessed about how stable and backwards-compatible the language is, or that D users must be bonkers to put up with the breakages. Using C++ both professionally and for hobby projects, in the last 5 or so years I can remember encountering exactly 1 (gcc) compiler bug. There was a simple workaround + someone else had already reported it so with the next minor update the bug was fixed. And the code that triggered it was a nested CRTP spawn of hell so I didn’t blame the compiler from borking on it in the first place, it would’ve been better for everyone had it never compiled :p

    Upgrading a major C++ compiler version was never free in my experience, but even when working in a codebase with ~2M LOC the upgrade (e.g. 14 -> 17) was something that could be prepared in a set of feature branches by one person over the span of one, maybe two weeks. That’s for fixing compile errors, I don’t remember if we had issues with runtime errors due to an upgrade, but if we did it must’ve been minor because I remember the transition to 17 was pretty smooth. Note that 14 -> 17 requires changing the requested C++ version for the project, which is different from upgrading the actual compiler, i.e. you can do the latter without the former and your code should not require any changes.



  • It would be odd to not have HR involved in hiring imo. When I was hiring for my team I was happy HR was involved, I gauged technical ability + fit for the team, HR gauged general fit with the company. We’d then have a chat afterwards to compare and see whether we would move forward with the candidate, and honestly the opinions were always along the same lines. It took some of the responsibility off my back knowing that the candidate received the green light from an independent party as well.




  • I think motivation is a bit more nuanced than that. Also what is said isn’t restricted to programmers. Money is an external motivator, which means it isn’t really motivating as in providing fulfillment and energy when doing a job. It can give you a reason to to the job, “it pays the bills” or “it pays the bills extremely well”, but that’s something different.

    That being said, I do look for jobs where I am motivated about the projects and the environment. In fact this is the main thing I evaluate when applying for a position. I also expect to be (and am) well-paid but I’m not aiming for the top bucks, because those jobs don’t interest me. I’m spending 8 hours a day doing this work, a big majority of the high-quality hours of the week are sunk into the job. I’m happy I get to spend them doing things I enjoy, with people I enjoy working with, as opposed to having to slog through them just because I need the money.


  • I rebase almost daily. I (almost) never merge the main branch into a feature branch, always rebase. I don’t see the point of polluting the history with this commit (assuming I’m the only dev on this branch). I also almost always do an interactive rebase before actually pushing a branch for the first time, in order to clean up commits. I mostly recreate my commits from scratch before pushing, but even then I sometimes forget to include a change in a commit I’ve just made so I then do an interactive rebase to fold fixup commits into the commits they should’ve been in.

    I like merging for actually adding commits from a feature branch to main (or release or …)


  • And anyway… it’s trivial to fix. If you still have the commit ID of the tip of the branch before the pull, go back to that. If not, look it up in the reflog. If that’s too much of a hassle, list the commits you only have locally, stash any changes, reset to the origin/the_branch and cherry-pick your commits again and/or apply the stash.

    I really embraced git once I understood that whatever I did locally, it’s most of the time relatively easy to recover from cock-ups. And it’s really difficult to lose work from the moment you’ve added it to a (local) commit or stashed it.

    I do understand that git is daunting however, and there is plenty where I think the defaults are bad. Too often I’ve seen merge commits where someone merged a the remote of a branch into the local copy of the same branch, or even this on main. And once this stuff gets pushed it’s neigh impossible to go back.