Reputation: 1861
Our team uses Bitbucket for collaboration and we have enabled pull-request workflow for master
and develop
branches. This means these two branches become read-only and cannot be push
ed to. They can only be changed via creating a branch from them, making changes, pushing the branch, creating a pull-request from it and having another team member review it and merge the request on top of the original branch via BitBucket interface.
Unfortunately, when creating the merge request, BitBucket interface defaults to master
, instead of the actual parent branch of current feature branch, and occasionally team members forget to change it to develop
before creating the merge request or approving it. This has led to master
and develop
diverging from each other and now we cannot merge develop
on top of master
when we want to release.
If develop
was not forbidden to push
to, I could rebase
it from master
, apply all non-existing commits, and then push --force
to make it a descendant from the tip of master
.
I tried branching from develop
and rebase
ing it from master
to have it include all commits from master
and then send it as a merge-request to develop
, but there are merge conflicts and BitBucket refuses to allow it to merge.
Now I'm stuck. How can I fix this problem?
Upvotes: 1
Views: 3913
Reputation: 671
Did you try fast forward option during merge? It actually helped me to keep tree cleaner.
Upvotes: 0
Reputation: 720
You can checkout to your master
branch and take the lastest from master
via
git pull --rebase origin master
Since you're forbidden to push into master
and develop
both, you can try checking out into new branch from master
via
git checkout -b <new-branch-name>
Now you'll be on , rebase from your develop
branch
git rebase develop
Now you'll have all commits which are in master and develop, you can delete the develop
branch via
git branch -D develop
git push -d origin develop
and push the via
git push -u origin <new-branch-name>
and raise a Pull Request from to master. Hopefully, this will resolve your issue.
Upvotes: 1