git:如何从远程分支获取并合并到本地分支? [英] git: How to fetch from a remote branch and merge into local branch?
问题描述
我是从
结果
- github.com/MYACCOUNT/ mantisbt
从我克隆它并检出分支(我感兴趣)到我的本地机器。
我的问题是我想要获取最新的分支(master-1.2.x)从远程仓库(mantisbt / mantisbt)合并到同一个分支到我的本地仓库。
这会导致类似于
这是怎么完成的?
更新: 内容取自 并合并到当前签出的分支中
Github在他们的forfor repohelp documentation 。
git remote add git://github.com/mantisbt/mantisbt
//将原始仓库分配给一个称为上游的远程仓库
git fetch upstream
I am forking from
which results in
- github.com/MYACCOUNT/mantisbt
from where I clone it and checkout the branch (I am interested in) to my local machine.
My issue is that I would like to fetch the latest branch (master-1.2.x) from the remote repository (mantisbt/mantisbt) and merge it under the same branch the to my local repository.
Which would result in something like
- git fetch remote-repo-branch
- git merge remote-repo-branch/local-branch
How is this done?
UPDATE:
content is fetched with
- git fetch upstream master-1.2.x
and merged to currently checked out branch with
- git merge origin/master-1.2.x
Github has an example of exactly this in their "fork a repo" help documentation.
git remote add upstream git://github.com/mantisbt/mantisbt
// Assigns the original repo to a remote called "upstream"
git fetch upstream
这篇关于git:如何从远程分支获取并合并到本地分支?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!