git push -u origin dev
To gitee.com:josie12345/springboot-2022nocv.git
! [rejected] dev -> dev (non-fast-forward)
error: failed to push some refs to ‘gitee.com:josie12345/springboot-2022nocv.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.
这个错误提示是因为你本地的代码和远程仓库的代码有冲突,需要先解决冲突,然后再进行推送。
你可以先使用 git pull origin dev 命令将远程仓库中的最新代码拉取到本地,然后再进行推送。如果有冲突,需要先解决冲突再进行推送。
另外,如果你确定要覆盖远程分支的代码,可以使用 git push -f origin dev 命令进行强制推送。但是在使用强制推送前需要确保你知道自己在做什么,因为这可能会覆盖掉别人的代码,引起一些不可挽回的问题。