Updates were rejected because the tip of your current branch is behind its remote counterpart

0 votes

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?

May 5 in Git & GitHub by Kichu
• 19,040 points
3,970 views

No answer to this question. Be the first to respond.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.

Related Questions In Git & GitHub

0 votes
2 answers

Reset commit of remote branch

Just fix the issue on your local, ...READ MORE

answered Aug 13, 2018 in Git & GitHub by Nilesh
• 7,040 points
759 views
0 votes
1 answer

fatal: The current branch master has no upstream branch

Hi@akhtar, You got this error, because you did ...READ MORE

answered Apr 30, 2020 in Git & GitHub by MD
• 95,380 points
3,151 views
0 votes
1 answer

error: The branch 'dev1' is not fully merged.If you are sure you want to delete it, run 'git branch -D dev1'.

Hi@akhtar, When you create one new branch in ...READ MORE

answered May 10, 2020 in Git & GitHub by MD
• 95,380 points
1,785 views
0 votes
1 answer
0 votes
1 answer

How to stash untracked files of the current working directory in Git?

Hi@akhtar, In order to stash untracked files, add ...READ MORE

answered Nov 20, 2020 in Git & GitHub by MD
• 95,380 points
8,840 views
0 votes
1 answer

How to get the current branch name in Git?

Hi@akhtar, You can run the git branch command ...READ MORE

answered Dec 22, 2020 in Git & GitHub by MD
• 95,380 points
7,844 views
+15 votes
2 answers

Git management technique when there are multiple customers and need multiple customization?

Consider this - In 'extended' Git-Flow, (Git-Multi-Flow, ...READ MORE

answered Mar 27, 2018 in DevOps & Agile by DragonLord999
• 8,450 points
2,081 views
+2 votes
1 answer
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP