如果你也像我一样发生过在 <no branch>的git 环境中进行过git commit然后忘记新建branch,就git checkout master,这时要找到你那些commit就要执行git fsck --lost-found或git fsck --unreachable或git log -g找到你在no branch上的<commit> 串,之后git checkout <commit>git branch <new branch>就好了。