-- git status
HEAD detached from 3c6d1a8 Changes to be committed: (use "git restore --staged <file>..." to unstage) new file: .idea/deploymentTargetDropDown.xml Changes not staged for commit: (use "git add <file>..." to update what will be committed) (use "git restore <file>..." to discard changes in working directory) modified: .idea/misc.xml
提示分支detached了。
解决:
1,查看当前分支状态 git branch * (HEAD detached at 925fda6) master 2,新建一个临时 tem 分支,把当前提交的代码放到整个分支 git branch tem git checkout tem 3,换回要回到的那个分支,这里是 master git checkout master 4,然后 merge 刚才创建的临时分支 git merge tem5,检查是否有冲突,没有就提交到远端 git push origin master 6,删除临时分支 git branch -d tem
参考:
https://blog.csdn.net/weixin_28715953/article/details/112870208