git学习--git回退版本后如何push
作为一个初学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, usegit push origi...
·
作为一个初学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分支上继续
更多推荐
已为社区贡献1条内容
所有评论(0)