0

Under Jira, I did create a bitbucket development branch called "RHI-89"

enter image description here

I wanted this development branch to point three commits behind the master's HEAD. After running git fetch to fetch the newly created branch onto my local machine, I checked out to this development branch and performed a hard rest:

git checkout RHI-89
git reset --hard HEAD~3

Running git log confirmed that the reset worked properly.

However, trying to push to the remote repository returns a "rejected" error, followed by these hints:

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.

I understand what is going on, but I do not know how to fix this issue. Is there a way to "prune" the remote development branch so that I can push the local branch without raising any conflict?

Sheldon
  • 4,084
  • 3
  • 20
  • 41

1 Answers1

0

If you are the only one working on this branch RHI-89, in this case, personally I use git push -f to push my local reset

Here is the doc of the -f option

Ahmed HENTETI
  • 1,108
  • 8
  • 18
  • 1
    Thanks for your answer, Ahmed. I actually preferred to push only the development branch to play it safe. I will accept your answer as the `-f` option did the trick. – Sheldon May 14 '21 at 21:44