hint: Updates were rejected because the tip of your current branch is behind
DanKim0213
Posted on February 8, 2023
Troubleshooting
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.
💖 💪 🙅 🚩
DanKim0213
Posted on February 8, 2023
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.