0 评论

0 收藏

分享

[git相关技术] git使用之hint: the same ref. If you want to integrate the remote changes, use hi

git使用之hint: the same ref. If you want to integrate the remote changes, use hint: ‘git pull’ before pushing again.没拉代码提交代码不被允许-如何强制推送本地代码覆盖远程仓库-优雅草央千澈解决方案
1,问题
hint: ‘git pull’ before pushing again
To https://gitee.com/youyacao/doc.youyacao.com.git ! [rejected]        master -> master (fetch first)error: failed to push some refs to 'https://gitee.com/youyacao/doc.youyacao.com.git'hint: Updates were rejected because the remote contains work that you do nothint: have locally. This is usually caused by another repository pushing tohint: the same ref. If you want to integrate the remote changes, usehint: 'git pull' before pushing again.hint: See the 'Note about fast-forwards' in 'git push --help' for details.解决方案
强制推送本地内容覆盖远程仓库方法:
执行
git push -f origin <branch_name>
这里的 -f 或 —force 参数表示强制推送,origin 是远程仓库的别名,<branch_name> 是你要推送的分支名称。
请注意,强制推送可能会导致远程仓库中的提交历史被覆盖,因此在使用时要谨慎
优雅草央千澈这里是默认分支master,于是执行:
git push -f

直接成功,结束。

优雅草论坛2022年8月11日大改,优雅草论坛变回只服务于客户的提问交流论坛,详情查看优雅草8月11日大改,原因详情查优雅草外卖乐关闭

回复

举报 使用道具

全部回复
暂无回帖,快来参与回复吧
yac2025
优雅草的临时工
主题 164
回复 0
粉丝 0