Git:在本地合并远程分支 [英] Git: Merge a Remote branch locally

查看:836
本文介绍了Git:在本地合并远程分支的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我通过 git fetch --all 来拉取所有远程分支。我可以看到我想通过 git branch -a 合并的分支作为remotes / origin / branchname。问题是它不可访问。我不能合并或签出?

I've pulled all remote branches via git fetch --all. I can see the branch I'd like to merge via git branch -a as remotes/origin/branchname. Problem is its not accessible. I can't merge or checkout?

推荐答案

您可以引用这些远程追踪分支〜(以 git branch -r )与他们的远程名称。

You can reference those remote tracking branches ~(listed with git branch -r) with the name of their remote.

如果您想合并您的本地分支上的其中一个远程分支: / p>

If you want to merge one of those remote branches on your local branch:

git checkout master
git merge origin/aRemoteBranch

如果您想在其中一个远程分支上合并您的本地分支,您需要首先在所述远程分支的顶部创建一个本地分支:

If you want to merge one of your local branch on one of those remote branch, you need to create a local branch on top of said remote branch first:

git checkout -b myBranch origin/aBranch
git merge aLocalBranch

这篇关于Git:在本地合并远程分支的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆