git work on small branch that has dependency on unmerged branch

Viewed 59

This is a problem I've encountered a few times and am curious what the right course of action is. I'm sure it's been asked before but I can't find the right language for the title.

I have a large feature branch checked out, that is still being reviewed, we'll call it branch A

I'm working on a smaller feature on branch B, but it's actually dependent on code that's in branch A

If I just merge branch A into branch B, I'll eventually have tons of conflicts when I go to merge branch B into master, because it will also have all of the changes from branch A

Assuming I can't just merge branch A into master before pulling it and then working on branch B, what's one to do in this situation?

1 Answers

Personally, I try to isolate the code I need from branch A in a single commit (I use interactive rebase git rebase -i to isolate this code if it is not yet in a separate commit) and then I cherry-pick this commit to branch B

Related