Skip to content
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 --keep-emptied by default when squashing #4668

Open
joefiorini opened this issue Oct 17, 2024 · 2 comments
Open

Comments

@joefiorini
Copy link

Is your feature request related to a problem? Please describe.
On my team I often have to make small code changes to my repo that I never want to push (typically for local env configuration stuff). I've found the easiest way to handle that in jj is to work with multiple revisions in parallel. My working revision doesn't have any changes in it, instead it is a descendant of all the revisions that have my code changes, one of which is the change I am actively working on and pushing. I use squash to move changes out of my working revision into whichever rev they actually belong to. I never want to abandon that working revision, therefore I always have to make sure I pass --keep-emptied to squash otherwise I'll have to set everything up again.

Describe the solution you'd like
I'd like a configuration setting that would default squash to never abandon empty revisions, allowing me to abandon them manually if I need to.

Additional context
I'd be happy to take a stab at implementing this myself, would such a feature be welcome?

@yuja
Copy link
Collaborator

yuja commented Oct 18, 2024

We tend to avoid adding config knob that changes the default command behavior. The rule isn't strict, but I don't think squash --keep-emptied is common enough to be an exception and add --no-keep-emptied.

I never want to abandon that working revision, therefore I always have to make sure I pass --keep-emptied to squash otherwise I'll have to set everything up again.

I don't think you'll have to use --keep-emptied (unless you need to preserve the commit description.) New working-copy commit will be created with the same parents if abandoned.

@essiene
Copy link
Collaborator

essiene commented Oct 21, 2024

I don't think you'll have to use --keep-emptied (unless you need to preserve the commit description.) New working-copy commit will be created with the same parents if abandoned.

As @yuja mentions, if you use the new+squash[1] workflow, a new head will be created if the old head is squashed. Unless you're using the edit[2] workflow. The default is the new+squash workflow.

If you're using the edit workflow though, I would call this a rather unique workflow and an alias like in [3] would be your best bet rather than a config setting.

[1]

[ui.movement]
edit = false

[2]

[ui.movement]
edit = true

[3]

[aliases]
#keep-emptied-squash ;-)
kesquash = ["squash", "--keep-emptied"]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants