'How merge (git rebase) multiple commits in a remote branch in Bitbucket

I am asked to merge multiple commits in a remote branch in BitBucket. enter image description here The last two and first three commits are contributed by different people.

I have watched some YouTube videos, but still cannot figure out how to do this. Below is what I did:

Run this command in a local branch

git rebase -i HEAD~5

enter image description here

And then

git push <local_branch>:<remote_name> -f

Once I push this, my pull request gets declined. If I try to re-open my pull request, I will see this error message: enter image description here

Does anyone know how to combine a bunch of commits?



Solution 1:[1]

Have you tried rebasing your branch from the latest version of the remote branch? Looks like that's the reason for the rejection?

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Vijay Raghavan Aravamudhan