Kadir Erdem Demir Kadir Erdem Demir - 18 days ago 5
Git Question

Git merging sub branches before merging to master

I have branch A . I know that it is save but because of some procedures I can't merge it to master branch(in my case it is code review I need to wait some of my colleagues to review my code ). Now I need to start another feature let say this one is branch B.

Branch B depends on some features that I implemented in branch A. But since I couldn't merge A to master, B does not has this features.

Is it a good idea in my case to merge branch A directly to branch B even before merging A to master?

Answer

You can just create new branch B from branch A (not "merge A directly to branch B"):

git branch B A
git checkout B

Do your work. After branch A is merged to master, use rebase:

git checkout B
git rebase master

Continue to work on branch B

Comments