I prefer rebasing my feature branch onto Master branch before PR (Pull Request). But, sometimes I got this:
$ git push origin feature/specific-feature 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.
This happens when I already pushed Feature branch to Github and thus the sync between my local feature branch and the remote branch in GitHub got broken. To resolve this issue:
$ git push -d origin specific-feature $ git push origin specific-feature
Some developers recommend using force-push. Though, in my preference, deleting the remote branch is more appropriate since force-push has several caveats and I or my colleagues in some situations would abuse force-push if we are used to force-push.
This flag disables these checks, and can cause the remote repository to lose commits; use it with care.
Top comments (3)
ChatGPT wrote this
This corrected my commit error exactly. I really appreciate for this f**kin adorable post! thx Dankim, I luv u :)