How to resolve git merge conflict without pulling master branch into feature branch?

Viewed 1116

Lets say our project is set up so that we have a QA environment and a Production environment.

When we work on a feature we branch off of the Production environment.

When we are ready to QA the changes, we merge the feature branch into the QA branch.

We use BitBucket for our remote. I've went ahead and made a pull request from my feature branch into the QA branch.

BitBucket claims there is a merge conflict in one of the files.

With how I understand git, the standard solution is to pull the QA branch into my feature branch, resolve the conflicts, commit the changes, and finally push that into my feature branch.

However there are a lot of changes in the QA branch that we do not want to make it into the production branch.

How do I resolve the conflict without pulling the QA branch into my feature branch?

1 Answers

Cherry-pick the changes related to this feature branch alone onto QA branch. This can be done easily like this:

git rebase --onto qa-branch production-branch my-feature

That is, assuming the changes related to the feature are set one after the other on their own branch.

Related