cornstalks 2 hours ago [-]
> The idea, particularly as realized in the GitHub pull request workflow, is that the real “unit of change” is a pull request, and the individual commits making up a PR are essentially irrelevant.

I loathe GitHub PRs because of this. Working at $dayjob the unit of change is the commit, and every commit is reviewed and signed off by at least 1 peer.

And you know what? I love it. Yes, there's some overhead. But I can understand each commit in its entirety. I and my coworkers have caught numerous issues in code with these single-purpose commits of digestible size.

Compare this to GitHub PRs, which tend to be beastly things that are poorly structured (not to mention GitHub's UI only adding to the review problems...) and multipurpose. Reviewing these big PRs with care is just so much harder. People don't care about the commit message, so looking at the git log it's just a mess that's hard to navigate.

epage 1 hours ago [-]
My ideal workflow is commits are as small as possible and PRs "tell a story", meaning that they provide the context for a commit.

I will split up a PR into

- Individual steps a a refactor, especially making any moves their own commits

- I add tests *before* the feature (passing, showing the old behavior)

- The actual fix or feature commit is tiny, with the diff of the tests just demontstrating how behavior changed

This makes it really fast to review a PR because you can see the motivation while only looking at a small change. No jumping around trying to figure out how the pieces fit together.

The main reason I might split up a PR like that is if one piece is likely to generate a discussion before its merged. I then make that a separate PR and as small as possible so we can have a focused discussion.

I hate squash merges.

Izkata 60 minutes ago [-]
As someone who has often had to dig into the history to figure out what happened, I always want to see at least this. And I wouldn't be opposed to seeing it broken down even more as it was worked on. Not one big squash merge that hides what really happened.

I'll also add one more to your list: Any improvements that came out of the review but stayed in that merge should each be individual commits. I've seen hard-to-trigger bugs get introduced from what should have been just a style improvement.

wtallis 2 hours ago [-]
Worrying about individual commits is also what makes it possible for you to later use git bisect without going crazy.
marssaxman 7 minutes ago [-]
How often do you find that command useful?

In ~18 years of git use, I have never needed it, but I see it mentioned often as an important reason to handle commits in some certain way. I wonder what accounts for the difference.

stavros 2 hours ago [-]
Is this what Gerrit does?
cornstalks 12 minutes ago [-]
Pretty much, yes. I've only used Gerrit a few times so my direct experience is limited.
2freedi 16 hours ago [-]
I began using Jujutsu as my VCS about 2 months ago. Considering most of my work is on solo projects, I love the extra flexibility and speed of being able to safely fixup recent commits. I also love not having to wrangle the index, stashes, and merges.

`lazyjj` [1] makes it easier to navigate around the change log (aka commit history) with single keypresses. The only workflow it's currently missing for me is `split`.

For the times when I have had to push to a shared git repo, I used the same technique mentioned in the article to prevent making changes to other developer's commits [2].

It's been a seamless transition for me, and I intend to use Jujutsu for years.

[1] https://github.com/Cretezy/lazyjj [2] https://jj-vcs.github.io/jj/latest/config/#set-of-immutable-...

nchmy 11 hours ago [-]
Check out jjui - it is VASTLY better, and the dev is extremely open and responsive to feature requests.

https://github.com/idursun/jjui

KwanEsq 16 hours ago [-]
Huh, reading the penultimate "“Units of change” and collaboration" section reinforces the feeling that Github PRs really are a poor way to do code submission/review, and have been holding back a lot of the industry from better ways of working for a long time.
andrewaylett 3 hours ago [-]
GitHub-style PRs are the worst way of reviewing changes, except (in practice, if not in theory) for all the others :P.

When my then-employer first stated using git, I managed to convince them to set up Gerrit -- I had my own personal Gerrit instance running at home, it was great. I think it lasted about a year before the popularity factor kicked in and we switched to GitLab.

At least part of the difficulty is that approximately everyone who would need to learn how to use a new mechanism is already familiar with PRs. And folk new to the industry learn pretty quickly that it's normal and "easy". The cultural inertia is immense, and that means we're much more likely to evolve our way out of the hole (or switch to a completely different paradigm) than we are to en-mass switch to a different way of working that's still Git.

There are ways to make the PR experience more reasonable; GitHub has introduced stacked PRs which queue up. Even without that, I find disabling merge commits puts my team in a sweet spot where even if I'd prefer Gerrit, I'm not tearing my hair out and neither are the rest of my team who (mostly) don't care all that much.

dorian-graph 15 hours ago [-]
It's maddening, considering their size, and that there are proven other examples out there of versioned change sets and divorcing the commit ID from the content ID.
cole_ 44 minutes ago [-]
Surprised no one has mentioned https://graphite.dev/ yet. Our team uses it for stacked PRs, and it works really well.
hbay 48 minutes ago [-]
Skimmed the article so I admittedly can't speak to much to the content of it, but just wanted to give my 2c on working on individual things after spending a lot of time working with a stack-based VCS in mercurial/sapling -- jj felt pretty hard to get used to and after a couple of weeks I gave it up. I think it needs a competitive visualization tool to Interactive Smartlog.

I've settled on using Interactive Git Log in VSCode.

account-5 16 hours ago [-]
I would really love a comparison between JJ and fossil. I use fossil for personal projects instead of git. So I'd like to know if I should consider JJ.
graemep 15 hours ago [-]
It looks like it is aimed at larger projects, whereas fossil is nice for personal projects because it was designed by and for a small team.

JJ itself uses Github, where as fossil is very easy to self-host including issue tracking, wiki etc.

dcre 2 hours ago [-]
jj is just a CLI, analogous to git alone. It doesn’t come with any of the other stuff Fossil does. I don’t think large/small project makes any difference either.
sashank_1509 26 minutes ago [-]
Sounds a lot like what’s being used internally at Google
renerick 15 hours ago [-]
This article covers my own experience with JJ very accurately. I'll even go as far as to say that if had to write my own article about jj, I'd use exactly the same talking points and examples. Great writeup
dorian-graph 15 hours ago [-]
Like the author, I'd appreciate a stacked PRs approach, integrated with GitHub (unfortunately). E.g. `a → b → c → d` where I have PRs open for `b`, `c` and not yet on `d`, that are "linked" to the jj changes. So 1 change per PR or it could even be multiple. I've lately become a huge fan of git-spice, that just works.
IshKebab 15 hours ago [-]
Stacked PRs is clearly a nice workflow... except that forges like Github generally have really poor support for them.

I wish Github would just allow you to say "this PR depends on this other PR", and then it wouldn't show commits from the other PR when reviewing the stacked PR.

But as far as I know you can't do that.

xrd 15 hours ago [-]
If you change the target branch it will only show commits that are against that. I wish GitHub did that automatically because it has the parent commit tree but when do you that you'll only see commits that diverge from the target branch/pr.

Is that what you want?

IshKebab 12 hours ago [-]
Not really. I've tried that with Gitlab, but it's kind of awkward. My PR isn't to merge branch B into branch A. For instance if the project owners see the PR for B and say "yeah great! I'll merge this" and press merge, it will just merge it into branch A and then close your PR!

It's a hacky workaround at best. I want proper support. I want Github to disable the merge button until the dependencies are merged. I want it to actually list the dependencies and link to them. I want the target branch to be `main`.

I think if they did those 3 things it would go 90% of the way. Too much to ask though clearly.

aaomidi 15 hours ago [-]
That works but depending on how you merge the PR, you end up needing to do a rebase on all of your future PRs.

I really wish 1PR = 1 commit with revision based diffs. Similar to gerrit.

dorian-graph 12 hours ago [-]
Another person has commented that you can do this, but it's a little known thing. git-spice automatically manages it for you too.
steveklabnik 11 hours ago [-]
It also doesn't work from forks.
dorian-graph 6 hours ago [-]
This has annoyed me a few times, just recently a week ago. Thanks GitHub.
k__ 15 hours ago [-]
I often have "no changes" in my Codespaces, because I haven't committed then yet.

Would be nice, if Codespaces keeps the JJ change stored somewhere, so it isn't tied to the lifetime of the machine.

jffhn 15 hours ago [-]
Jujutsu - I like the name.

I often see programming as going MMA with data, until you get what you want out of it.

Using brute force algorithms is going berserk, vibe coding is spamming summons in hope they get the job done, etc.

az09mugen 15 hours ago [-]
Agreed, I'd just like to complement vibe coding feels like spamming retarded Mr Meeseeks hoping they get get the job done. It's _probabilistic programming_
abcd_f 16 hours ago [-]
A thing to learn from JJ's performance is that not everyone is cut out to direct Star Wars movies.
FridgeSeal 30 minutes ago [-]
Or Star Trek.
cadamsdotcom 14 hours ago [-]
It’s clear from multiple posts over years that jj has a better UX than plain git.

Why not just merge it into git?

wmf 13 minutes ago [-]
It's too different. At best you could make it an off-by-default mode.

And I'm sure there are some people who actually prefer Sapling or raw git.

yowlingcat 16 hours ago [-]
Nice writeup -- had been wondering about how it compares to Git (and any killer features) from the perspective of someone who has used it for a while. Conflict markers seems like the biggest one to me -- rebase workflows between superficially divergent branches has always had sharp edges in Git. It's never impossible, but it's enough of a pain that I have wondered if there's a better way.
steveklabnik 11 hours ago [-]
For me, it's not so much that jj has any specific killer feature, it's that it has a fewer number of more orthogonal primitives. This means I can do more, with less. Simpler, but also more powerful, somehow.

In some ways, this means jj has less features than git. For example, jj doesn't have an index. But that's not because you can't do what the index does for you, the index is just a commit, like any other. This means you can bring to bear your full set of tools for working on commits to the index, rather than it being its own special feature. It also means that commands don't need certain "and do this to the index" flags, making them simpler overall, while retaining the same power.

15 hours ago [-]