Hi Brian On 09/08/2024 20:29, Brian Lyles wrote:
If you perform a rebase using `--autostash`, and the pre-rebase hook exits with a non-zero exit code, your worktree is left in some sort of invalid state. This is reproducible with the following script:
Thanks for reporting this. It looks like the rebase code was written on the assumption that we only write the state files after successfully checking out the commit we're rebasing onto. Unfortunately "--autostash" breaks that assumption as it creates the autostash state file much earlier leading to an inconsistent state if the rebase cannot start. I'll post a fix later this week.
You're able to recover from this by using `git rebase --quit` and then resetting to the commit you were on before attempting the rebase.
I don't think you should need to reset HEAD as it should be untouched. You can get the stashed changes back by running "git stash --apply" with the oid from the "Created autostash: ..." line that rebase prints.
Best Wishes Phillip