How do I merge another developer's branch into mine?

一笑奈何 提交于 2020-04-07 10:54:09

问题


I am relatively new to git. Our organization uses a Fork & Pull Model for managing changes to the master branch. Each developer forks the master and branches from their fork when adding new features. I keep an eye on commits that other developers are making in their own branches, and would sometimes like to merge these changes into my own branch. What steps do I take to accomplish this?


回答1:


You first need to add the other developer repository as a remote.

git remote add otherrep uriToOtherRep

Then you fetch changes from there

git fetch otherrep

And then you merge the branch from the remote repository into yours

git merge otherrep/branchname

Happy merging!




回答2:


You can also do "git pull", it'll pull the changes of all the branches.

git pull

You can run git merge into your current branch

git merge origin/<branchname>




回答3:


once you have the branch in question in your repository as, say, anotherdev/master remote branch, you do the git merge anotherdev/master.



来源:https://stackoverflow.com/questions/11582894/how-do-i-merge-another-developers-branch-into-mine

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!