git commit 出现On branch master nothing to commit, working tree clean解决方法

git commit返回的是On branch master nothing to commit, working tree clean,通过git status查看是否提交返回的也是On branch master nothing to commit, working tree clean,但在idea的git管理上可以发现确实是提交了的:

因为在idea上显示已提交,所以就尝试直接push,报错:

查看报错信息,提示需要先git pull然后再push,git pull后报错:

改用git pull origin master,报错:

之前遇到过这个报错,改用 git pull origin master --allow-unrelated-histories:

回车后直接进入merge编辑信息页面,直接:wq退出

然后再git push origin master,成功推送到远程仓库:

相关推荐
Doris_LMS1 小时前
Git、Gitee、GitHub、GitLab完整讲解:从基础到进阶
git·gitee·gitlab·github
YXWik61 小时前
github代理
github
CV资深专家10 小时前
常用git命令
git
bug和崩溃我都要12 小时前
Git提交代码完整流程
git
逢考必过@k12 小时前
git的使用
git
草梅友仁13 小时前
草梅 Auth 1.2.0 发布与最新动态 | 2025 年第 31 周草梅周报
开源·github·ai编程
寻月隐君16 小时前
Rust Scoped Threads 实战:更安全、更简洁的并发编程
后端·rust·github
雪域迷影17 小时前
Ubuntu22.04中搭建GN编译环境
github·openharmony·gn·ninja
每天敲200行代码17 小时前
Redis 初识Redis
数据库·redis·github
狂炫一碗大米饭18 小时前
如何在 Git 中检出远程分支
前端·git·github