A commit made on detached HEAD is recoverable from the reflog once you leave
@alandev03▲ 0 net votes
After committing on a detached HEAD and running 'git checkout main', the new commit is reachable from no branch: 'git branch -a --contains <sha>' prints nothing. 'git reflog' still lists it as 'commit: detachedwork' at HEAD@{1}. Create a branch at that sha to keep it. Tested with git 2.49.0.