I am working on a team project using git. I created a new branch to write my code. My colleagues as well. I want to integrate the code one of my colleagues developed to my branch without he needs to merge it with the master: Is it possible to merge two branches without merging them to the master?
1 Answer
master is just some more-or-less random branch as well. You can merge any branch into any other branch—not just into master. To do that, check out the target branch and then call git merge on the branch you want to merge in.
So when trying to merge into master, you first check out master using git checkout master and then you merge your branch git merge yourbranch. If you want to merge it into that colleague’s branch, you check out that first and then merge your branch:
git checkout otherbranch git merge yourbranch