5 ms·
I think `git add -p` and its friends are another thing I'd point to for this. I've never really struggled too hard to get git commits into different branches f
by mpyne 1y ago
I think `git add -p` and its friends are another thing I'd point to for this.
I've never really struggled too hard to get git commits into different branches for review, but if you've put unrelated changes into the same working dir, you'll want `git add -p` to sort them out into multiple commits.
Note there are corresponding `-p` flags for things like git-restore and git-reset as well.
- steveklabnik 1y agojj tends to use -i for 'interactive' to do what you do with -p in most git commands. It is in fact a great tool, jj makes doing this even easier.
- mpyne 1y agoI'm sure it's great but I don't have the problems with git that others apparently do, so as to make it worth switching to a whole new mental mode of source code management. At least uv solved real problems I was having with Python package management, but for my own personal usage git is 99% aligned with what I need.
- steveklabnik 1y agoI didn’t have problems with git either. jj just makes all of the stuff I liked to do with git easier and faster, and lets me do some things you can’t do with git. But you should use the tools you want to use.
- BeetleB 1y agoJust FYI: The person you're responding to wrote a very popular tutorial on jj. He's been using git since the early days, and as he puts it: > Now I am not one of those "the git CLI is too complex and git is too hard to learn" people, but I do acknowledge that puts me in the minority. But let's reframe that: if we can make something more powerful and easier? Sign me up!
- mpyne 1y ago> Just FYI: The person you're responding to wrote a very popular tutorial on jj. That's nice. I know of him better from his Rust work, but he explained himself well enough in his own comment that he probably doesn't need your assistance to reiterate a point he made very effectively on his own. Also, he's not the only one who's used git since the early days.
- steveklabnik 1y agoI have no clue why you’re downvoted, I had upvoted you by the way.
- mpyne 1y agoThanks. I was pretty snarky, in fairness, though I felt it was only matching the energy of that type of white knighting (which a decade ago I feel pretty sure would have gotten you downvoted into oblivion even on HN, but maybe I'm not hip with the times anymore! lol)
- stouset 1y agoLet’s say you’ve checked out a new branch and done a bunch of work over the course of the last two hours. You’ve added a new feature. In doing that, you’ve also fixed four unrelated bugs, clarified the documentation for a method you needed to use, and rewritten another function to be more performant. You could push this all as six commits on one branch. PR reviewers will now have to figure out what parts are related to what, or read each commit one-by-one. If someone wants changes to one of these commits, your entire branch is held up. Or you could split these six different commits out to each be directly on `main` and make a PR for each of them. They can be tested in CI, reviewed, and merged in isolation. The latter is far better. You can do it in git, but it’s not exactly fun. It is trivial in jj.
- palata 1y agoThis is the kind of example that I find insightful. I know I can do it with git and it's not hard. It's not fun, but it's not hard. So I will disagree with anyone who says that it's impossible with git. But it is great to know that it is trivial in jj. That's a reason to try :-).
- stouset 1y agoIt’s definitely not impossible! It might not even be hard these days (git has accrued a million flags and features), but it is definitely friction. And it might not seem like much, but it adds up. And all of that friction stops you from even considering things that might genuinely be hard. Everything feeling like it’s a slightly uphill battle isn’t something you always notice until it’s suddenly gone.
- mpyne 1y ago> You could push this all as six commits on one branch. No, I'd probably put them all as individual branches to be reviewed, assuming they're truly independent changes. As long as they don't actually conflict it's not very hard to do this in git. But this is kind of what I mean when I say that git fits my needs, because I wouldn't come across 4 unrelated tasks like this in the course of implementing a single commit's worth of features, unless I was having the world's biggest attack of ADD. And if these things did need to get done to properly implement the feature to our team's quality standards, it would be appropriate to be included in that feature's PR as well. I'm sure it's a nice tool, especially for those who work in domains where it takes a long time to land your commits into the main branch of development, but a lot of this sounds like solutions to problems that we don't all have.