简体   繁体   中英

Merging different branches on git

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?

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM