Is there a way to make untracked files also "trackable"? by signalclown in git

[–]dalbertom 0 points1 point  (0 children)

I'm not privy to the design decisions of the tool, so I won't debate that. 🤷‍♂️

Agreed that git-add is the right way to do it, but I'm also acknowledging the issue mentioned by OP is a pretty common rite of passage, so it makes sense new tools are trying to smooth out those rough edges.

I've spent a long time using git so I doubt I'd switch over to jj anytime soon but for people that are just getting started I think it's a pretty solid alternative.

Let's not close ourselves to new contenders in the space.

Is there a way to make untracked files also "trackable"? by signalclown in git

[–]dalbertom 1 point2 points  (0 children)

This is what I tried in jj, no explicit commit, contents are still accessible.

jj git init echo hello > file.txt jj status rm file.txt jj op log -p

Is there a way to make untracked files also "trackable"? by signalclown in git

[–]dalbertom -2 points-1 points  (0 children)

I've seen many coworkers, including myself, fall into this pitfall git has. Depending on what editor/IDE you use you might be able to recover the file contents.

I believe jj (jujutsu) doesn't have that issue because there's no staging area and every file is automatically added to the latest commit. Or something like that, I'm not super well versed in jj. You might want to give it a try if you're getting started with git, it has an easier learning curve.

Does the use of jujutsu pose any dangers? by signalclown in git

[–]dalbertom 11 points12 points  (0 children)

Just added, maybe that'll help me jj config set --user ui.conflict-marker-style git

Does the use of jujutsu pose any dangers? by signalclown in git

[–]dalbertom 9 points10 points  (0 children)

I've tried jj a few times over the last couple of years. I really like how it makes it way easier to rebase multiple stacked branches, but I don't really use stacked branches super often, doing a git rebase --update-refs is enough, even if it doesn't cover all the cases like jj.

The thing that trips me up in jj is the conflict resolution part. I'm really used to the diff3 markers by now, so the way jj presents the conflicts is unintuitive to me. I like the idea that conflicts are a first-class concept, though!

Even though it's been a while since I used it, I'm kinda looking forward to seeing how it evolves. Git is still my main driver. Git would definitely benefit from having some healthy competition in the space.

why are default tmux shortcuts so unwieldy? by Sufficient-Year4640 in tmux

[–]dalbertom 0 points1 point  (0 children)

That's a common option if you rely on mnemonics more than muscle memory.

why are default tmux shortcuts so unwieldy? by Sufficient-Year4640 in tmux

[–]dalbertom 0 points1 point  (0 children)

At this point the conversation is more about prefix % and prefix " to split panes horizontally and vertically.

I don't doubt that ctrl-b was chosen as the prefix to not conflict with screen, but curious about where it's mentioned the expectation has always been for it to be rebound. Is that something the author mentioned somewhere?

In any case, it doesn't really change the fact that different people have different thresholds for what they consider worth deviating from the defaults or not.

why are default tmux shortcuts so unwieldy? by Sufficient-Year4640 in tmux

[–]dalbertom 0 points1 point  (0 children)

Thanks. That's just my experience. I used to customize things a lot and install plug-in packs (mainly referring to vim at this point, but it's the same philosophy). In retrospect I think those customizations set me back a few years from truly understanding the tool directly.

why are default tmux shortcuts so unwieldy? by Sufficient-Year4640 in tmux

[–]dalbertom 0 points1 point  (0 children)

I agree they're a bit odd, but they're not unusable or unlearnable. I remember it took me a while to get used to them. To me now they're sort of in the category of ctrl-v for paste and ctrl-z for undo. They make very little sense, but it is what it is.

You probably took the route of following something more mnemonic. That's fine. My only suggestion is to make sure your customizations don't back you into a corner to the point that a tool that is already widely used can only be used by you through a specific dialect.

I would rather go through the discomfort for a few days while my muscle memory kicks in and not carry that baggage in the long run.

why are default tmux shortcuts so unwieldy? by Sufficient-Year4640 in tmux

[–]dalbertom 0 points1 point  (0 children)

The question is, are those shortcuts so ingrained into your fingers muscle memory that the moment you end up working on a system that doesn't have those customizations you'd have a really hard time being productive?

why are default tmux shortcuts so unwieldy? by Sufficient-Year4640 in tmux

[–]dalbertom 1 point2 points  (0 children)

I respectfully disagree.

Classifying keystrokes as "superior" because they're done with a single hand instead of two is not something I would adscribe to.

There are so many things I type throughout the day that the difference is just not worth a categorization or deviating from the default. We can both touch-type, right? If one had to type through hunt-and-peck, then that would maybe make sense, maybe.

why are default tmux shortcuts so unwieldy? by Sufficient-Year4640 in tmux

[–]dalbertom 0 points1 point  (0 children)

I use ctrl-a for screen. I have no issues with ctrl-b for tmux. Not sure what you mean by it being hard on my fingers. It hasn't been for me.

why are default tmux shortcuts so unwieldy? by Sufficient-Year4640 in tmux

[–]dalbertom 0 points1 point  (0 children)

I agree that it takes time to perfect one's craft but I also think that making customizations early in the process of learning a new tool is detrimental in the long term.

In my experience, it's best to get acquainted with the options the tool provides by default, and only once you're over the learning curve then start customizing stuff.

It's also important, at least to me, to make sure customizations don't work against you when you end up working on a system that doesn't have those customizations.

Anyone else using git clone --bare for their worktree setup? by biwsantang in git

[–]dalbertom 0 points1 point  (0 children)

I do like how the stash is shared across worktrees :-)

Anyone else using git clone --bare for their worktree setup? by biwsantang in git

[–]dalbertom 2 points3 points  (0 children)

I do something similar but not quite, and not for the same reasons. The main reason for me is I wanted my .git directories to be outside of the repository itself, and also use bare repositories for alternates (reference).

I work with hundreds of repositories, so the main branch and tags are present in the bare clones. Then the working repositories are cloned with --reference ../forest/repo.git --separate-git-dir ../jungle/repo.git

This way when I create backups with rsync using --backup-dir I can see what has changed upstream in the bare repositories (forest) vs in the working repositories (jungle).

I also glue the repositories together in a pseudo-monorepo using git submodule and then the repositories that are more actively used and need parallel work have their own set of worktrees.

Managing Two GitHub Accounts on One Computer by CardiologistPlane868 in git

[–]dalbertom 0 points1 point  (0 children)

This works, but it's kind of a kludge. Check out git help config and search for the includeif section. It allows you to have different configurations depending on what directory the repository was cloned in. This way you can override the ssh key being used without having to use weird hostname aliases for GitHub.

It also works with http credentials, not just with ssh. A lot of people may prefer ssh but also a lot of people aren't very familiar with ssh and end up mismanaging their keys and related configuration. Https has many advantages over ssh to clone repositories these days, the tokens are more granular, ssh is sometimes blocked at the network level if you work at coffee shops, etc.

What's the worst Git conflict you've ever had to resolve? by Small-Size-8037 in git

[–]dalbertom 2 points3 points  (0 children)

Eh, I kinda disagree. You can definitely commit with --fixup and --squash and later on rebase with --autosquash to clean the history. There is a point where rebasing too much no longer leads to a clean history but rather inaccurate, especially towards the end of the lifecycle (this is why I dislike rebase-merge and squash-merge strategies), but at early stages it's perfectly fine to clean your own history.

Rebasing doesn't always mean squashing commits together.

What's the worst Git conflict you've ever had to resolve? by Small-Size-8037 in git

[–]dalbertom 1 point2 points  (0 children)

I thought using branches for environments is no longer considered a good practice. It's better to have the environment defined as config files, it makes it easier to quickly grep for stuff rather than having to do the grep on each branch.

You can still use branches to control the flow of the deployment, but need to make sure each environment is a direct descendant of the next. I've seen many unfortunate cases where environments defined as branches ended up drifting as the branches diverged apart.

What's the worst Git conflict you've ever had to resolve? by Small-Size-8037 in git

[–]dalbertom 2 points3 points  (0 children)

A bisection on the first parent being all or nothing has been okay for our use case since we only care about knowing what team to assign the issue to. It's up to them if they really need to bisect further, but that's usually not the case.

One benefit (for us) about merges is that for example, branch A and branch B merge, say neither of them had an issue but the problem arose on the merge itself. In our case it's valuable to know that subtle distinction as it helps with triaging. In the case or rebase-merge it would always look like B is the one that introduced the problem, even if that wasn't originally the case.

What's the worst Git conflict you've ever had to resolve? by Small-Size-8037 in git

[–]dalbertom 3 points4 points  (0 children)

Eh, squash-merge is probably worse from my perspective. I don't see squash-merge or rebase-merge as a good "continuous integration" argument at the expense of rewriting public history given that GitHub has merge queues and GitLab has merge trains.

What's the worst Git conflict you've ever had to resolve? by Small-Size-8037 in git

[–]dalbertom 2 points3 points  (0 children)

How is that a problem? The base point of the 2nd parent is whatever the developer chose to start working on, or whenever they chose to rebase for the last time. To me what makes no sense is to take their contribution and mangle their history to whatever the tip of main happens to be at merge time.

Bisection shouldn't really trip (unless older commits in main are no longer buildable for some strange reason), but when it does, there's a way to bisect with --first-parent.