Live data from Hacker News

Ask HN: Git Alternatives – Sapling vs. Jj

news.ycombinator.com

21–30 of 66 posts

Re: Ask HN: Git Alternatives – Sapling vs. Jj

#21

> I am uninterested in `you can do that in git with [insert esoteric commands]`. Why? If the only requirements you specified are that you're looking for something that is compatible with Git but with better ergonomics, wouldn't something that wraps Git (whether that's via aliases or something more comprehensive) fit the bill?

It's a fair question, but the answer is simple: because there are significant design choices in the UX and algorithms which are user visible, and percolate throughout the entire system design, which can't just be wrapped or alias'd away.

There is git-branchless, which is kind of like this[1][2] and is something like a half-way point between Git and Jujutsu/Sapling. However, it needs to be stated that git branchless does NOT just "wrap" existing things or alias them. It has significant engineering to add features, using a lot of code, because you can't "just" add things like revsets or 'undo' using wrappers or aliases, at least not in an efficient way.

Some examples from Jujutsu are that:

A) jj rebase is lightning fast compared to git rebase, because it works in memory. Git rebase touches disk for all operations, so it becomes slower the larger the repo, the more history, the bigger the files etc you have. You may spend significant IOPS moving large-ish files around, flushing the index to disk, and so forth; and you also cannot do things like rebase inside a bare repository (imagine you want a handy "Rebase branch on main" button in your GUI -- you need to have the whole working copy to do that!) jj rebase works entirely in memory so it never touches the disk for any files in the commits themselves. This is called "git move" in git-branchless, but requires significant code. Git itself is trying to solve this with a new "git replay" command, but it is extremely new and has some current limitations compared to, say, Jujutsu, IIRC. (But the fact they have to add a whole new command with significant code is a good example of how the algorithmic differences matter and can't be papered over.)

B) Revsets are a non-trivial addition to make the commit graph "queryable", but they add open ended features in a way that can't easily be recreated without them, because they are composable. For example, "list all commits authored by me that are not merged into main that can be rebased on main" is written as `all:mutable() & mine()`, but to recreate this level of flexibility you would need a dozen one-off features added to something like 'git log' -- but these revsets can work with many more commands than log! You can use the above revset to automatically rebase all your open branches at once for example, which is not possible in Git without shell scripting (what about Windows users?) and duct-taping stuff. But then where's the reuse?

C) Jujutsu has a notion of first-class conflicts, which can only be vaguely approximated with something like `git rerere` and `git rebase --update-refs`, but this isn't quite the same because for example you need to know details like purging the rerere cache if you get a conflict resolution wrong and want to undo it and start over, not to mention you can still easily screw things up mid-way with `git rebase` in a form that requires you to start over. These "catches" do not apply to Jujutsu and I have no idea where you would even begin if you wanted to add a feature like this.

So, the details matter a lot in practice for users, and delivering them a good experience is something that I think is way more difficult than just a bunch of opinionated commands. To be clear, if you like opinionated aliases and wrappers, that's OK! But there's a lot more underneath the surface if you scratch at it a bit.

[1] https://github.com/arxanas/git-branchless

[2] The main developer of git-branchless also is a Jujutsu contributor, so these ideas and the implementations aren't totally a coincidence!

Re: Ask HN: Git Alternatives – Sapling vs. Jj

#22
post #19

A question: I prefer jumping into the command line for most of my git work. But, I'm intrigued by this discussion and wonder: how well do these tools work within an editor? I am using Zed, which IMHO has poor git support anyway. I'm curious if the experiences here are mostly from people who do not use their editor as their main point of contact with the code repository they are working on.

I use jj and zed. More appropriately, I happen to use jj and I also happen use zed, and I never really think about them together. All repo-level work I do with the cli. The only thing I really care about in-editor is recency on a line level, and since jj uses git, zed has no problem showing line-level metadata. There is a slight difference because of jj's stage consolidation, but I don't find that to be a problem, since there's not much of a difference between a line in a staged file vs a line in the working tree.

Re: Ask HN: Git Alternatives – Sapling vs. Jj

#23

> I am uninterested in `you can do that in git with [insert esoteric commands]`. Why? If the only requirements you specified are that you're looking for something that is compatible with Git but with better ergonomics, wouldn't something that wraps Git (whether that's via aliases or something more comprehensive) fit the bill?

You mean how jujutsu uses the same git repo and you can use jj while other people you collaborate use git?

Yeah they're doing that.

Re: Ask HN: Git Alternatives – Sapling vs. Jj

#24
post #22
post #19

A question: I prefer jumping into the command line for most of my git work. But, I'm intrigued by this discussion and wonder: how well do these tools work within an editor? I am using Zed, which IMHO has poor git support anyway. I'm curious if the experiences here are mostly from people who do not use their editor as their main point of contact with the code repository they are working on.

I use jj and zed. More appropriately, I happen to use jj and I also happen use zed, and I never really think about them together. All repo-level work I do with the cli. The only thing I really care about in-editor is recency on a line level, and since jj uses git, zed has no problem showing line-level metadata. There is a slight difference because of jj's stage consolidation, but I don't find that to be a problem, si…

Thanks so much for this!

Re: Ask HN: Git Alternatives – Sapling vs. Jj

#25
post #10

Earlier quoted context omitted.

The command line interface for Sapling called `sl`, which is Git compatible, is fully supported by the team at Meta. You can file bugs and feature requests, etc, though the repository is a bit intimidating. It is only the non-Git server components (Mononoke, EdenFS) that are not yet really supported [1] but I think most people aren't really concerned with that, when writing a post like this. For all intents and purpo…

What's the advantage of using Sapling as an alternative Git frontend?

You don't need to manage the stash or index, those are just expressed as commits, so you have fewer commands and a simpler UX, and can use universal tools like 'split' to handle cases you'd otherwise need stash/apply/switch to handle.

It supports Mercurial-like "revsets", so it is easy and flexible to query the commit graph for all kinds of information, in a user-controlled way.

Features like 'sl absorb' can do git 'fixup commits' automatically.

It supports a notion of changeset evolution, so if you have `A -> B -> C` and `A` gets merged into main, it will automatically rebase `B -> C` on top (among other things).

"isl", the "interactive sapling" GUI, is absolutely stellar and I don't think there's a faster way to do tasks like 'rebase X onto Y' or "reorder commits in stack Y" than that, even with Jujutsu.

It comes with integration for a tool named ReviewStack so you can do stacked code reviews while working on GitHub.

There is an undo command to undo your mistakes.

And, while I'm not sure this is in the Git backend today, many algorithms like getting the history of a file are O(N) in terms of file history as to the history of the whole repo (e.g. try `git log file` in gecko-dev or Linux and it is slow.)

Many of these advantages (not all) are shared with Jujutsu, to be clear.

Re: Ask HN: Git Alternatives – Sapling vs. Jj

#28
post #10
post #8

There's also Pijul. I have only had a brief play with Jujutsu and I haven't tried Sapling but from what I can see, Jujutsu is definitely the best option if you want to actually get stuff done while mostly maintaining Git compatibility. Pijul is definitely still in the research prototype phase, and definitely not Git compatible. I don't know how Git compatible Sapling is, but large parts of it are still labelled "Not…

The command line interface for Sapling called `sl`, which is Git compatible, is fully supported by the team at Meta. You can file bugs and feature requests, etc, though the repository is a bit intimidating. It is only the non-Git server components (Mononoke, EdenFS) that are not yet really supported [1] but I think most people aren't really concerned with that, when writing a post like this. For all intents and purpo…

Just the name makes it a no-go for me, it would interfere with my favorite command-line utility, `sl` - Steam Locomotive

https://github.com/mtoyoda/sl

Re: Ask HN: Git Alternatives – Sapling vs. Jj

#30
post #17

I have been using `git-branchless` a lot and really liking it. It should be part of the main git project, consider it a halfway between git and switching to some other tool.

For what it’s worth, the main developer of git-branchless is also a `jj` contributor
Post reply on HN