-
Notifications
You must be signed in to change notification settings - Fork 433
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
FR: --allow-empty
for squash
and unsquash
.
#1406
Comments
Maybe there could be a |
Oh, there is |
Exactly, |
If I want to start with nothing, I would expect the left side to contain all changes, which I can apply to the right side. |
Isn't there a |
I'm not sure I follow, so let's make it concrete with an example. Let's say the parent commit has a file that looks like this:
Your working copy looks like this:
Let's say the bug fix is the a->A change. What would you like to see on the left and right side? |
And I change right to contain |
I see. That would make it harder to review your changes before you save, though, because you would review the changes that remain (i.e. going into the child commit). It might still be a useful feature. |
Another option is to keep the left and right side as it but make the left side editable and use that as the middle commit. |
Probably I didn't get it, but for:
What I would do with jj is: jj new -A @- # new wc commit, -A being --insert-after, meaning children of @- (so, the previous wc, our big work) are rebased on top of it
echo "fix" > file
jj describe -m "fixed"
jj edit @+ # go back to our work
With jj the mindset should be that you can always move off the working commit and come back, no stashes or anything, that's like one of the main features (the one I personally extremely like) |
So the fix is already part of the wc, I'd like to move it from the wc, instead of creating a new commit and redo it. redoing it might be fine if the fix is really just a one-liner. But sometimes the fix can be large enough to be annoying to redo, and still just be a small part of the changes in wc. |
|
I think I like that option better because the diff is from left to right as usual. It still has the problem that it's hard to inspect the changes that will go into the parent commit before confirming. Of course, the current solution has the problem that it's hard to inspect the changes that will go into the child commit. It might be best if the diff tool could show both diffs compared to the initial versions, probably with 3 panes next to each other. But I don't think most diff tools support that, so that's probably not really an option except for in TUIs/GUIs we control. |
I just started using jj, so maybe there is a better way to do this:
Scenario
While I was working on a big feature, I noticed a bug in the code base. The fix is a one-liner, and I want to commit it separately first, then continue working on the big feature.
With git, I would
git add -p
the change and thengit commit
. With jj, I wouldjj describe
the bug fix,jj new
to create a new working copy,jj unsquash -i
to move everything except the bug fix.The problem
Because the bug fix is small and everything else is big,
unsquash
ing everything else is annoying. It would be easier tojj unsquash --allow-empty
everything first, keeping the parent commit, thenjj squash -i
to move only the bug fix.The text was updated successfully, but these errors were encountered: