-
Notifications
You must be signed in to change notification settings - Fork 403
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: Configuration setting to use --skip-empty
by default when rebasing.
#2758
Comments
Cc to @matts1, at least to let him know you found the feature he recently implemented useful. I have a minor worry: it might be confusing if Aside: It'd be natural to want the automatic rebasing to skip empty commits as well when the option is set, but it unfortunately loses information (descriptions of empty commits). Also, I'm slightly biased at the moment, since I'm working on refactoring related code, so I don't want to add new features like that right now. The alias is a great suggestion. Could you try using that to see how it goes? I'm curious, why do you think it's less user friendly? I wonder whether we could solve those issues instead. My main problem with aliases is that they break command-line completion; I wonder whether we could try fixing that, at least for simple aliases. I should, at least, file a bug. |
@ilyagr thank you for your reply, and thank you to @matts1 for building the feature indeed!
I didn't consider this. As a user I would indeed expect any rebase operation skips the empty commits. Regarding losing the information, I think I'd be OK with it... but I cannot think of any scenarios where it might be a problem. One way to minimise the issues here is to be explicit in the command output when a commit is skipped. Imagine this operation would create an empty commit:
^^^ I think it is useful to tell the user if we are skipping commits regardless of the outcome of this issue. I can create a new issue to track this change
Maybe 'user friendly' was too strong of a term from my side. Maybe I just like it more. The following is very much my train of thought and it's not well organised, so apologies in advance :D. I think with an alias I end up building muscle memory to a command that only exists in my config. I want to change the default behaviour of a command (
And be done with it. I use the command that git provides. As a user I find more user-friendly (read: I like it more) to be able to configure the default commands other than create custom aliases that only I use. Makes sense? However...
I also wonder myself if the only scenario where I want the empty commits to be gone is when I'm restacking PRs, and with any other kind of rebasing I would like the default behaviour to still keep the empty commits... Right now an alias is a way to test this for myself. |
#2600 has some related discussion. I'm currently leaning towards having the auto-rebase logic not change the shape of the graph, but maybe we could make an exception for empty commits. Note that if your proposed config is about abandoning all empty commits (if they were rebased), not just emptied commits, then you'd often lose the working-copy commit and merge commits. So if we do add a config for it, I think we'd want it to be about abandoning emptied commits (i.e. commits that were non-empty and became empty as a result of the rebase). |
@martinvonz yes! That's actually what I meant. (I guess that's also what |
That's a good point, it'd help. This would only show one line of the description but. That might be OK since, given the commit id of the removed commit, it is possible to recover it's description with something like
No problem, this is what I was asking for, thanks for writing it! Overall, my own mind is not made up one way or another, but there's food for thought here that I might try to digest at some later point, and perhaps others will have more thoughts or stronger opinions. |
This argument can also swing the other way. I could argue that if you don't have your config, it's safer to see "this command does not exist" as opposed to the command silently behaving differently than you expected. With git's options like |
This is what I wanted to say, but you worded it better than I would.
It's not just you and your config, but a support team having to get user config in order to help them, and project teams having to dictate the config for the team so tools all behave the same way everywhere. |
Yes, this was also in my mind. I tend to lean the other direction... but to be honest I don't have a strong argument for it, other than "git does it like that" and "I like it more". I appreciate the discussion about the feature though. If you decide to not implement it I would still use |
Hi! First of all, thank you for building
jj
:)tl;dr: As a user, I'd like a configuration setting to always execute
jj rebase
with the--skip-empty
flag.Is your feature request related to a problem? Please describe.
My team uses
merge --squash
to integrate the changes in themain
brach. I often do stacked PRs. For example I would have abranch_1
whose PR usesmain
as a base, and abranch_2
whose PR usesbranch_1
as a base.When the PR for
branch_1
gets approved, themerge --squash
creates a new commitD
on top ofmain
with the changes ofbranch_1
. When rebasing thebranch_2
on top ofmain
, the default behaviour ofjj rebase
will create an empty commit.The empty commit can of course be avoided with
jj rebase --skip-empty
, but I do this kind of rebasing often enough that I almost always add the flag.Describe the solution you'd like
I'd like configure
jj rebase
to add--skip-empty
by default. The command will need a new--no-skip-empty
flag to use the original behaviour when needed.When executing the
rebase
, it would also be useful to output which commits have been skipped when running the command. (I don't recall if this is the case already, but this can be a separate issue).Describe alternatives you've considered
I can do this as an alias (
reskip
or something) but I would prefer to have this as a config flag.git
does this for several flags (there are settings for always runninggit pull --rebase
orgit rebase --update-refs
). I find it more user friendly.I think
--skip-empty
could also be the default behaviour, but I don't have any arguments for this. But regardless of the default, a config flag to allow the user to change it still has a use.The text was updated successfully, but these errors were encountered: