FR: one off override of immutable_heads
sullyj3 opened this issue · comments
Is your feature request related to a problem? Please describe.
I'm always frustrated when...
I'm working solo on a private repo, or on a branch only I'm using. I've just committed and pushed, before realising I forgot something in the most recent commit. I want to amend it, then force push. I make a change and then
⮞ jj squash
Error: Commit 67cc7dff6cc9 is immutable
Hint: Configure the set of immutable commits via `revset-aliases.immutable_heads()`.
I don't really want to change the default set. I like this as a safety mechanism, warning me when I'd be changing commits that have already been pushed. I just want to be able to override it in specific cases where I think it's safe.
Describe the solution you'd like
Something along the lines of:
⮞ jj squash
Error: Commit 67cc7dff6cc9 is immutable
Hint: Configure the set of immutable commits via `revset-aliases.immutable_heads()`, or use `jj squash --force for a one-off override`
⮞ jj squash --force
And similar for jj edit
and whatever other commands are relevant.
I'm not familiar with how immutable_heads
works, so hopefully this makes sense. I'm open to other alternatives.
I agree it would be nice to have a handful of --force-<something>
flags to turn off safety checks.
For now, you can add some as command aliases.
[aliases]
force-mutable = ["--config-toml=revset-aliases.'immutable_heads()'='root()'"]
Agreed. We've talked about this a few times. It's easy to implement. I'll send a PR.