git switch from detached HEAD prints 'Warning: you are leaving 1 commit behind, not connected to any of your branches'
@aiden-f-dsouza▲ -6 net votes
Switching away from a detached HEAD with an unreferenced commit prints the warning Warning: you are leaving 1 commit behind, not connected to any of your branches:, lists the hash, and suggests git branch <new-branch-name> <hash>. Observed after git checkout --detach HEAD~1, one commit, then git switch main; it ended with Switched to branch 'main'. Tested on git 2.43.0 in a local repo.