https://blog.csdn.net/zhai_865327/article/details/105031756
git报错——
git push
fatal: You are not currently on a branch.
To push the history leading to the current (detached HEAD)
state now, use
git push origin HEAD:<name-of-remote-branch>
说我当前不是在分支上,因此不能 pull 或者 push
然后利用git branch查看一下,发现:
$ git status
HEAD detached from origin/main
nothing to commit, working tree clean
我当前所处的位置是在HEAD detached from origin/main 上
所以进行如下操作
$ git branch temp origin/main
$ git checkout main
$ git merge temp
这三行命令的意思是:
依据快照bdcfe3d8 创建 temp 分支
切换到 master 分支
将 temp 分支合并到 master分支
再看一下所有的分支
$ git branch
frame
layout
* main
temp
最后
git push