zlacker

[return to "Stacked Diffs with git rebase —onto"]
1. swaits+JWe[view] [source] 2025-12-05 13:31:28
>>flexdi+(OP)
Every time I see one of these nifty git tricks or workarounds I find myself wondering, “why not just use jj?”

You get a nicer, significantly simpler interface. You don’t need any tricks. You don’t have to google how to work yourself out of a bad state, ever. And you get near-perfect git compatibility (ie you can use jj on a shared git repo, doing all the same things, and your teammates won’t know the difference).

I’ve wondered if there is a psychological thing here: someone who spent time memorizing all the git nonsense may have some pride in that (which is earned, certainly), that introduces some mental friction in walking away???

◧◩
2. hansvm+Fef[view] [source] 2025-12-05 14:59:18
>>swaits+JWe
> introduces some mental friction in walking away???

I don't think it's just mental friction. Suppose you've learned git well enough that everything you do in it is automatic and fast, and the things which aren't fast by default you've built aliases and tooling for over the years. Yes, starting from ground zero you might want something like jj, but at the current point in your life you're not starting from ground zero. Switching to jj means learning another tool to achieve similar outcomes on your workflows.

◧◩◪
3. tcoff9+npf[view] [source] 2025-12-05 15:45:30
>>hansvm+Fef
But with jj there are better workflows that aren’t really doable with git.
◧◩◪◨
4. jhhh+JBf[view] [source] 2025-12-05 16:32:14
>>tcoff9+npf
Last time I saw this claimed (maybe from steve's tutorial?) it was just autosquash. Do you have another example?
◧◩◪◨⬒
5. tcoff9+4eg[view] [source] 2025-12-05 19:16:37
>>jhhh+JBf
https://ofcr.se/jujutsu-merge-workflow

With `jjui` this strategy takes only a few keystrokes to do operations like adding/removing parents from merge commits.

It's so nice to have like 4 parallel PRs in flight and then rebase all of them and all the other experimental branches you have on top onto main in 1 command.

Also, I cannot even stress to you how much first-class-conflicts is a game changer. Like seriously you do NOT understand how much better it is to not have to resolve conflicts immediately when rebasing and being able to come back and resolve them whenever you want. It cannot be overstated how much better this is than git.

Also, anonymous branches are SOOOO much better than git stashes.

◧◩◪◨⬒⬓
6. 171862+LIg[view] [source] 2025-12-05 21:50:07
>>tcoff9+4eg
> Also, anonymous branches are SOOOO much better than git stashes.

You can do anonymous branches in Git as well. I use both for different use cases.

◧◩◪◨⬒⬓⬔
7. tcoff9+pMg[view] [source] 2025-12-05 22:13:10
>>171862+LIg
The UX around anonymous branches in git is not nearly as good as jj though.

Also git has no equivalent to the operation log. `jj undo` and `jj op restore` are so sweet.

◧◩◪◨⬒⬓⬔⧯
8. 171862+gsi[view] [source] 2025-12-06 16:24:49
>>tcoff9+pMg
I can't comment on the UX of jj, but with git you literally just specify the commit, it doesn't feels tedious to me.

> Also git has no equivalent to the operation log.

For easy cases it's just git reset @{1}, but sure the oplog is a cool thing. I think it will be just added to git eventually, it can't be that hard.

◧◩◪◨⬒⬓⬔⧯▣
9. martin+dui[view] [source] 2025-12-06 16:40:49
>>171862+gsi
You can specify a commit, yes, but how do you remember your set of unnamed commits? Once HEAD no longer points to a commit, it will not show up in `git log`.

I agree that Git could gain an operation log. I haven't thought much about it but it feels like it could be done in a backwards-compatible way. It sounds like a ton of work, though, especially if it's going to be a transition from having the current ref storage be the source of truth to making the operation log the source of truth.

◧◩◪◨⬒⬓⬔⧯▣▦
10. 171862+cxi[view] [source] 2025-12-06 17:05:43
>>martin+dui
The last one is always available via `git checkout -` and if you want to do more you can do `git checkout @{4}` etc. . It will also show up in `git log --reflog`. I honestly don't see the problem with naming things. Typing a chosen name is just so much more convenient than looking up the commit hash, even when you only need to type the unique prefix. When I don't want to think of a name yet, I just do "git tag a, b, c, ..."

I also tend to have the builtin GUI log equivalent (gitk) open. This has the behaviour, that no commit vanishes on refresh, even when it isn't on a branch anymore. To stop showing a commit you need to do a hard reload. This automatically puts the commit currently selected into the clipboard selection, so all you need to do is press Insert in the terminal.

> It sounds like a ton of work, though, especially if it's going to be a transition from having the current ref storage be the source of truth to making the operation log the source of truth.

I don't think that needs to be implemented like this. The only thing you need to do is recording the list of commands and program a resolver that outputs the inverse command of any given command.

[go to top]