git push error failed Workaround to push some refs to the

! [rejected] master -> master (non-fast-forward)

error: failed to push some refs to '[email protected]:yangchao0718/cocos2d.git
hint: Updates were rejected because the tip of your current branch is behin
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.

Problem Description

The essential reason : because the remote repository is inconsistent with the local library cause , then we put a remote database synchronization to the local library on it
General questions : occurs when the local library to submit to a remote repository.
Common causes : When we find a problem in github repository, you carried it on github online modifications; or you add a readme file, or other files directly on github in a library, but there is no local library synchronization. This time the problem push failure occurs when you want to submit again commit to the remote github repository from the local library.
My question: Create a local folder, open the git bash, output git init to initialize a local library, then git pull a remote database, the revised submission.
My reasons: after the remote repository pull down, is a complete library, and I had built a library, and use the local library (and not a puul down), and remote database synchronization.
My solution: pull down the file into the library folder, open the git bash, and push, on it.
 
Solution: This problem is because the remote library and local libraries caused by inconsistent, then we put a remote database synchronization to the local library on it.
Using the command: git pull --rebase Origin Master
This instruction means to update the remote repository merged into the local library, -rebase role is to cancel the local library just commit, and to bring them back after update among the versions of the library.
Figure:

 

 

Here I used the wrong case diagram to explain the occurrence of image and resolution

gitpush failure 2
git pull -rebase origin master intended to cancel commit record, and save them as a temporary patch (patch) (these patches into the ".git / rebase" directory), and then synchronize the remote to the local library, and finally merge the patch into the local among the library.
gitpush failure 3
Then you can push the local repository to the remote library among the.
gitpush failure 4

Most excerpt network

Guess you like

Origin www.cnblogs.com/Rainingday/p/12364690.html