作为一个初学git的萌新,在进行socket库封装时,出现了巨大的bug,只能回退版本,但回退版本后commit后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>
此时,我们无法push,可以先保存修改
git tag tmp
然后切换分支到master,并pull
git checkout master
git pull origin master
合并修改
git merge tmp
最后push,并删除tmp
git push origin master
git tag -d tmp
这样我们就将回退后的历史提交到了远程的master分支,继续开发时可以直接在master分支上继续
来源:CSDN
作者:彼方时间の幻梦
链接:https://blog.csdn.net/weixin_45802439/article/details/104117946