如何解决如何使用git从GitHub中的远程仓库中删除提交?
如何删除已经推送到远程的提交?我得到了删除我的最新提交的答案。在此Stack Overflow post的答案中,有人说要git reset --hard HEAD~1
删除最新的提交。我做到了,而且行得通,但是现在当我按下遥控器时,它给了我这个错误
To github.com:an4s911/login-system.git
! [rejected] master -> master (non-fast-forward)
error: failed to push some refs to 'github.com:an4s911/login-system.git'
hint: Updates were rejected because the tip of your current branch is behind
hint: its remote counterpart. Integrate the remote changes (e.g.
hint: 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.
它说在推之前要拉,所以我拉了。但是现在我已经删除了提交。我该如何解决这个问题?
解决方法
已解决!
我通过使用--force
是这样的push
语句来强制推送到远程
git push --force
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。