jj
jj copied to clipboard
FR: Command for resetting change ID
Is your feature request related to a problem? Please describe. If there are multiple commits with the same change ID and I want to keep both versions of them for some reason, it can be difficult to resolve the divergent change ID. I think it would be nice if there was a command that just replaces all commits in a revset with identical commits, except with new change IDs.
Describe the solution you'd like
I'm not sure what a good name for such a command would be, since jj reset-change-id
seems too long. Maybe it would be good to have a general command jj reset
that takes different flags depending on what needs to be reset:
# Reset change IDs of commits
$ jj reset --change-id <REVSET>
# Reset author name and timestamp of commits
$ jj reset --author <REVSET>
This might be confusing with git reset
, so it might not be a good idea. I do feel like this would be a better place to put "reset author" though, since the current jj describe --reset-author
feels like an unintuitive place to put it.
Another option might be a change-id
subcommand, but I'm not sure if there's any other operations on change IDs that would be useful. Maybe swapping change IDs could be useful (e.g. if jj split
left the change ID on the wrong commit), but that seems like a weird solution.
Describe alternatives you've considered
jj duplicate
followed by jj abandon
of the original commits works. This could maybe be done with an alias if aliases could execute multiple commands and take arguments to pass to each. Or maybe a new option like jj duplicate --replace <REVSET>
could duplicate the commits, but automatically abandon the previous versions and rebase their descendants onto the new commits.