Rya*_*ohn 54 git version-control github
我对git比较新.我们的组织使用Fork&Pull模型来管理对主分支的更改.在添加新功能时,每个开发人员都会从主分支中分叉主分支.我一直关注其他开发人员在他们自己的分支中进行的提交,并且有时希望将这些更改合并到我自己的分支中.我可以采取哪些措施来实现这一目标?
Chr*_*oph 81
您首先需要将其他开发人员存储库添加为远程.
git remote add otherrep uriToOtherRep
Run Code Online (Sandbox Code Playgroud)
然后你从那里获取更改
git fetch otherrep
Run Code Online (Sandbox Code Playgroud)
然后将远程存储库中的分支合并到您的分支中
git merge otherrep/branchname
Run Code Online (Sandbox Code Playgroud)
快乐合并!
Gio*_*ous 37
假设您当前正在分支上工作feature/feature_a,并且想要合并在另一个名为feature/feature_bto的分支中所做的更改feature/feature_a。以下命令应该可以解决问题:
git checkout feature/feature_b
git pull
git checkout feature/feature_a
git merge feature/feature_b
Run Code Online (Sandbox Code Playgroud)
Sum*_*lly 11
你也可以做"git pull",它会拉动所有分支的变化.
git pull
您可以将git merge运行到当前分支
git merge
origin/<branchname>