DEV Community

DanKim0213
DanKim0213

Posted on • Edited on

hint: Updates were rejected because the tip of your current branch is behind

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.
Enter fullscreen mode Exit fullscreen mode

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
Enter fullscreen mode Exit fullscreen mode

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)

Collapse
 
yezgoget profile image
YE G

ChatGPT wrote this

Collapse
 
dankim0213 profile image
DanKim0213

γ…‹γ…‹γ…‹γ…‹γ…‹γ…‹γ…‹γ…‹γ…‹

Collapse
 
whimsybin profile image
Whimsy-bin • Edited

This corrected my commit error exactly. I really appreciate for this f**kin adorable post! thx Dankim, I luv u :)