The solution to the conflict between the version on github and the local version (Updates were rejected because the tip of your current branch is behind)

 

Problem Description:

Updates were rejected because the tip of your current branch is behind

 

scene:

Create a project on github or coding, then git init locally

then no git pull -f --all

As a result, there is a conflict between the readme file and the local version in the version on github. The reasons for the conflict are given below:

 

[master][~/Downloads/ios] git push -u origin master

 

Username for 'https://github.com': shiren1118
Password for 'https://[email protected]': 
To https://github.com/shiren1118/iOS_code_agile.git
 ! [rejected]        master -> master (non-fast-forward)
error: failed to push some refs to 'https://github.com/shiren1118/iOS_code_agile.git'
hint: Updates were rejected because the tip of your current branch is behind
hint: its remote counterpart. Merge the remote changes (e.g. 'git pull')
hint: before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.

View most of the information, only this one is useful

http://www.cnblogs.com/xwdreamer/archive/2012/05/29/2523958.html

Check Force overwrite existing branches (changes may be lost), and then click Upload to upload successfully.

 

Only this sentence is the core, so I thought about it a little bit.

[master][~/Downloads/ios] git push -u origin master -f 

 

Original address: https://blog.csdn.net/shiren1118/article/details/7761203

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324871953&siteId=291194637
Recommended