git-updates-were-rejected-because-the-tip-of-your-current-branch-is-behind
ERROR:git: "Updates were rejected because the tip of your current branch is behind.." but how to see differences?
To github.com:holidaylandmark/holiday.git
! [rejected] master -> master (non-fast-forward)
error: failed to push some refs to 'github.com:holidaylandmark/holiday.git'
hint: Updates were rejected because the tip of your current branch is behind
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.
Solution
git push -f, a force push to update the remote (origin) branch.
0
I found this command works correctly:
git push -u origin main -f
You just need to add a -f flag to force the push.
1. Take a backup if you're working on feature branch and switch to master/develop branch by doing git checkout develop/master
2. Do git pull
3. You will get changes and merge conflicts occur when you have made changes in the same file which has not been rebased from develop/master
4. Resolve the conflicts if it occurs and do git push,this should work
Top comments (0)