Skip to content

Conversation

@claytonrcarter
Copy link
Collaborator

I've been using record --stash more often, and I've noticed that it doesn't work while on a detached HEAD: it creates the commit correctly, but doesn't switch back to the previous commit. It looks like this was identified in the original review but a fix didn't make it into that PR. I've added a test for this case, too.

After fixing that, I followed up with a refactor to reduce duplication between the logic that handles --detach (ie "move the branch back to the parent commit") and --stash (ie "and checkout the parent commit").

This addresses an overlooked review comment from arxanas#1150:

> issue: Won't this not work if no branch is checked out before trying to
> stash? In that case, it seems like git record --stash would make the commit
> without switching back to the parent commit.

And, indeed, that's exactly the case!

Ref: arxanas#1150 (comment)
@claytonrcarter claytonrcarter marked this pull request as ready for review September 26, 2025 20:44
@claytonrcarter claytonrcarter merged commit 113cc19 into arxanas:master Oct 7, 2025
13 checks passed
@claytonrcarter claytonrcarter deleted the record-stash-detached branch October 7, 2025 13:35
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

Successfully merging this pull request may close these issues.

1 participant