I want to update the code modified in my personal branch to the public development branch. After merging my branch into the local development branch, I want to update to the remote through push
, but something went wrong, and recently Often encountered. The following is my error message
Admin@Administrator MINGW64 /d/htdocs/work.local.com/www-local-com (develop)
$ git merge lernado
Updating 764de39..7717317
Fast-forward
controllers/ListsController.php | 1 -
1 file changed, 1 deletion(-)
Admin@Administrator MINGW64 /d/htdocs/work.local.com/www-local-com(develop)
$ git push origin develop
To git@git.develop.com:admin.site/www-develop-com.git
! [rejected] develop-> develop (fetch first)
error: failed to push some refs to 'git@git.develop.com:admin.site/www-develop-com.git'
hint: Updates were rejected because the remote contains work that you do
hint: not have locally. This is usually caused by another repository pushing
hint: to the same ref. You may want to first integrate the remote changes
hint: (e.g., 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.
Admin@Administrator MINGW64 /d/htdocs/work.local.com/www-local-com (develop)
Newbie, please give me advice
I think if your local development branch
develop
可能不是最新的,就是和远程的开发分支develop
不是同一版本。这种问题我遇到过,一般你在执行git push origin 分支
之前最好执行一下git pull origin 分支
is updated to the same version locally and remotely, then there will be no problem. You can try it again after executing the following commandHope it helps you
Direct translation of this English sentence, it means that in addition to your commit, there are things in the remote version that you don’t have locally. Please
git pull
check it firstHe reminds you that the branch you want to push to has commits that you don’t have locally. It is recommended to git pull the merge first and then push.
When pushing, it is very likely that someone else has submitted new code to the remote branch, so you need to pull the code first to make the local code up to date. If there is a conflict, resolve it and then push the code