We have a branch called dev We access it through origin/dev. I have another branch named FixForBug that tracker origin/dev. There's a branch on the remote server and I can create a pull request for that change to be approved and merged back into the dev branch. The problem is that when I do git push once it works fine. When I do it again for the second time then it shows an error.
error: failed to push some refs to 'https://github.mydomain.info/Product/product.git' hint: Updates were rejected because the tip of your current branch is behind its remote counterpart. Integrate the remote changes (e.g. hint: 'git pull ...') before pushing again. See the 'Note about fast-forwards' in 'git push --help' for details.
After this I did a git status it says I'm ahead of origin/dev by 1 commit.
I think I can fix this issue by running:
git push -f origin FixForBug
But I want to know if that is the correct way to do it and why do we need -f in this scenario?