[Solved] 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

Scenario.

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

and then no git pull -f –all

The readme file in the github version conflicts with the local version, and the reason for the conflict is 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.

 

Workaround:

Check the box to force overwrite existing branches (changes may be lost), then click upload, and the upload succeeds.

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

Translated with www.DeepL.com/Translator (free version)

 

Similar Posts: