I am trying to push my application with Source Tree.
I reverted the application (locally) to an old version, made some changes and now I want to push again, but I'm getting this error:
git -c diff.mnemonicprefix=false -c core.quotepath=false push -v --tags --set-upstream origin dev:dev
Pushing to https://[email protected]/hykaruz/assist-ponto.git
To https://[email protected]/hykaruz/project.git
! [rejected] dev -> dev (non-fast-forward)
error: failed to push some refs to 'https:/User:bitbucket.org/hykaruz/Project.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.
PS. My version was too old, I had to download the last version then I can commit and push my application, so if you get the same problem check to see if there's an update.
Because your commit history diverges from the upstream repository (you didn't just add more commits), git refuses to push the changes because you can lose work this way.
If you are sure you want to overwrite the upstream repository history with your own (e.g., you are the only one pushing to that repository), you have to add -f
to force the push.