But git names are not permanent, so just use whatever helps you remember: "just-ate-tuna-sandwich", "fifth-time-is-a-charm", "john-is-late", "idea-from-restroom", even "temp123"...
You can always rename to something that makes sense later.
git commit -am “Dead-end: I tried doing X but that didn’t work out”
git branch deadend/tried-doing-x
git reset —-hard HEAD^
I like this because, fully half the time I end up needing to draw some elements from that dead-end if it turns out later to have seeds of the right approach in it.`git branch <something-temporary>` is an absolutely fantastic workflow IMO, combined with committing early-and-often, it helps me decide on logical names for various snapshots of where I was when trying to solve a problem. When I hear people say “squashing is wrong” I can never understand what they’re on about: being able to make temporary semi-meaningful commits and branches on your way to the right answer to a problem, is an absolute godsend.
So yeah not only is the detached head state not a broken state, it's not even really a scary state to be in.
Good naming is hard, but you don't need those for your use case of potentially discardable work
That way a 1000 line pr consisting of 25 commits can be landed as 5 dependant prs with a much more focused review.
I could answer, but I don't think you're actually asking for someone to explain it to you.
I did want to offer a different opinion though. I like detached heads, they are unnamed branches, the first thing I do when working on something new is make a detached head and get to work, making commits, etc, if I decide the work is worth keeping, then I will name the branch. As some smart people have said, naming things is hard, I don't want to name a branch before I'm sure what it is or that I'm going to keep it. Having a bunch of commits that are not part of a branch might sound risky, but not if you understand that commits are never deleted (unless there 90 days old or more) and the reflog and other tools allow you to find commits you thought might be lost. Git does not lose commits, not ever.