Error: cannot push because a reference that you are trying toupdate on the remote contains commits

WeChat applet pushes to code cloud and reports error

This error message indicates that when you push, you are trying to update a reference (branch or tag) in the remote warehouse that contains a commit that does not exist locally. This usually happens when your local repository is lagging behind the remote repository.

A common way to solve this problem is to pull the changes from the remote warehouse to the local one and then push them. You can use the following command to perform this operation:

git pull origin mfy --rebase
git push -u origin mfy

The above command will first pull the changes in the remote warehouse to the local, apply your local commits to these changes, and then push them.

Or directly use git push -u origin mfy -f //where mfy is your branch name, this command is available.

Use  -f parameters to force push even if there are updates to the remote repository. -f Please make sure you double-check your changes before using  parameters as this may overwrite other changes in the remote repository.

Guess you like

Origin blog.csdn.net/m0_62323730/article/details/132474776