News for hackers. Stuff that matters.
Re:Jujutsu (jj), a Git compatible VCS by MarceColl on Sunday October 20, 2024 @11:01AM (#41895776)
And what are the steps when you work on 3 things at the same time (you are working on PR #2 + fixing issues in PR#1 + a hotfix needs to be deployed for an issue)? Or when you need to continue fixing things on the PR?

On the absolute happy path what you do above is the same I do, where jj shines is when you het out of the happy path.

Re:Jujutsu (jj), a Git compatible VCS by mjarrett on Sunday October 20, 2024 @11:20AM (#41895875)
Isn't git-worktree designed for this kind of situation, where you could open each PR or branch in its own directory and switch your editor / other tooling between workspaces without losing state between them?
Re:Jujutsu (jj), a Git compatible VCS by JTyQZSnP3cQGa8B on Sunday October 20, 2024 @11:45AM (#41896093)
You can already do that with git branches. Worktrees is a cleaner way to share history but it’s irrelevant to merge conflicts and multiple PRs.
Re:Jujutsu (jj), a Git compatible VCS by MarceColl on Sunday October 20, 2024 @11:25AM (#41895911)
yeah, you could do this, but it gets kind of annoying in my experience. However it is another solution, most of what you do in jj you can do in git, its just more convenient
Re:Jujutsu (jj), a Git compatible VCS by christophilus on Sunday October 20, 2024 @11:18AM (#41895864)
I stash or commit, switch branches, make changes, stash or commit, etc. What do you do?
Re:Jujutsu (jj), a Git compatible VCS by MarceColl on Sunday October 20, 2024 @11:20AM (#41895877)
that's what I used to do, now I just use jj and I dont need to either keep a set of stashes nor create superfluous commits based on when I decided to change branches
Re:Jujutsu (jj), a Git compatible VCS by edflsafoiewq on Sunday October 20, 2024 @11:06AM (#41895802)
Switch to branch for thing 1, work on it, commit, switch to branch for thing 2, work on it, commit, ...
Re:Jujutsu (jj), a Git compatible VCS by MarceColl on Sunday October 20, 2024 @11:17AM (#41895859)
Do you stash or create a commit with potentially partial work? What do you name that commit?
Re:Jujutsu (jj), a Git compatible VCS by wolfwyrd on Sunday October 20, 2024 @11:27AM (#41895922)
Whatever I want because —amend is a thing?
Re:Jujutsu (jj), a Git compatible VCS by MarceColl on Sunday October 20, 2024 @11:32AM (#41895975)
that's fine, what Im saying is that the above workflow is idealized and you have to do a lot more things overtime. If you look at the happy path it looks similar. With the unhappy path instead of keeping stashes and commiting trash then amending. You describe your change beforehand, and any change you do goes there. Thats it. Hotfix? jj new main go back to what you were working on? jj edit refA need to solve some problems in another pr of youre? jj edit refB.

Theres no overhead at all in thinking these, you can never lose work by mistake, you can never mess it up. It just works

Re:Jujutsu (jj), a Git compatible VCS by edflsafoiewq on Sunday October 20, 2024 @11:25AM (#41895915)
Personally I usually stash if it's partial work I'm going to return to soon. But you can create a commit if you want. Just name it 'WIP' or 'temp' or something. When you come back and finish it you can write the proper commit message.
Re:Jujutsu (jj), a Git compatible VCS by stouset on Sunday October 20, 2024 @01:02PM (#41896786)
And then you have to remember which branch the each entry of the stash was on, deal with unstashing conflicts, remember to drop the latest stash after fixing those, etc.

Tools like the stash are band aids that come with their own set of “fun” failure modes.

Re:Jujutsu (jj), a Git compatible VCS by edflsafoiewq on Sunday October 20, 2024 @02:42PM (#41897539)
If you don't like stash, then use WIP commits like I said.

The easiest and by far most common thing to do of course is to just complete the commit you're working on before switching branches.

Re:Jujutsu (jj), a Git compatible VCS by stouset on Sunday October 20, 2024 @05:24PM (#41898597)
I have accidentally pushed wip commits more times than I care to remember.

Wouldn’t it be nice if there was a tool that didn’t need you to internalize all these workarounds?

Re:Jujutsu (jj), a Git compatible VCS by edflsafoiewq on Sunday October 20, 2024 @05:50PM (#41898774)
I don't believe I've ever pushed a WIP commit. Count that to the benefits of stashing I guess.

I don't consider any of this a problem, but why don't you tell me how your preferred tool does it.

Re:Jujutsu (jj), a Git compatible VCS by stouset on Sunday October 20, 2024 @07:13PM (#41899280)
So when I say there a problems with stashing, you suggest wip commits. When I point out problems with wip commits, we go back to stashing?

jj needs neither because everything in your working copy is already part of a commit. You can’t accidentally push unfinished changes because jj will complain if it hasn’t been described (given a commit message). If you need to move changes between commits you don’t need to stash because you can easily move the contents of a commit around.

Re:Jujutsu (jj), a Git compatible VCS by edflsafoiewq on Sunday October 20, 2024 @07:49PM (#41899492)
Stashing vs WIP commits have pros and cons. I've never hit any of these problems you're pointing out, so I don't have any particular strong opinion about which one you should use.

I can see that being nice I guess.

If jj's stashes are just regular commits, don't you have the problem where you accidentally push a stash just like you push a WIP commit?

Re:Jujutsu (jj), a Git compatible VCS by stouset on Sunday October 20, 2024 @07:53PM (#41899506)
It’s not like these are git’s only pain points. Git is practically the poster child for software that’s difficult and confusing to use.
Re:Jujutsu (jj), a Git compatible VCS by edflsafoiewq on Sunday October 20, 2024 @08:03PM (#41899547)
I don't think so. Like the OP, my everyday git usage is pretty straightforward. So "maybe this thing you do every once in a while could be a little nicer" doesn't feel very compelling.
Re:Jujutsu (jj), a Git compatible VCS by steveklabnik on Monday October 21, 2024 @12:24PM (#41905747)
> don't you have the problem where you accidentally push a stash just like you push a WIP commit?

Because jj doesn’t require commits to be on a branch, and the equivalent feature (bookmarks) don’t automatically advance, if you created a new commit to stash some stuff, the name wouldn’t move to it, and so when you push nothing would happen.

Re:Jujutsu (jj), a Git compatible VCS by oxidant on Sunday October 20, 2024 @11:30AM (#41895953)
`git add .`, `git commit -m "wip: some note about what I was doing"

Then checkout the new branch and do my work.

When I come back, `git reset --soft HEAD^`, and continue

Re:Jujutsu (jj), a Git compatible VCS by BeetleB on Sunday October 20, 2024 @12:21PM (#41896422)
Your comment is a great ad for not using git.
Re:Jujutsu (jj), a Git compatible VCS by stouset on Sunday October 20, 2024 @01:05PM (#41896818)
Now let’s talk rebase/merge conflicts, stash conflicts, forgetting to un-wip, and on and on and on and then maybe acknowledge that all of these “but my git workflow is simple” comments are a convenient fiction that doesn’t actually exist in practice.