You can use git reflog to get the commit hash of the commit that you did while in “no branch” ( a detached HEAD) and merge that in to the branch that you are currently in ( master maybe)
Something like git merge HEAD@{1}
You can also git rebase -i and “pick” the commit you want from the reflog.