I have a feature branch branch-foo. It was branched off from master branch, which is our stable/production branch.
I have the following work process:
I pushed
branch-footo remote repo & created a pull request for team to review.Then, on my local branch
branch-foo, I did code updates based on pull request review comments. But I don't yet push it.At this point, I noticed the there are new merge to
master, so I fetched the latest master branch & did a rebase. That's rebase mybranch-footo the head of latestmaster.Now I try to push
branch-foowith my code updates. And get rejected git error:
! [rejected] branch-foo -> branch-foo (non-fast-forward)
error: failed to push some refs to 'bitbucket.org:myorg/my-project.git'
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.
- I see above error suggests me to pull, so I then tried
git pull origin branch-foo, but get another error:
From bitbucket.org:myorg/my-app
* branch branch-foo -> FETCH_HEAD
fatal: Not possible to fast-forward, aborting.
So, I get stuck that I am not able to push my changes, neither can I pull the remote. Our team enforces to only allow fast-forward, no direct merge allowed.
How can I properly solve this problem so that I can push my rebased branch to my pull request branch now?