git拉到另一个分支 [英] git pull on a different branch

查看:117
本文介绍了git拉到另一个分支的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果我在一个分支上工作,然后意识到我需要将另一个分支合并到我的分支中,这是我当前的工作流程(对于这个示例,可以说我在我的分支上工作,并且想在master中合并):

If I'm working on a branch and then realize I need to merge another branch into mine here is my current workflow (for this example lets say that I'm working on my-branch and want to merge in master):

git stash
git checkout master
git pull
git checkout my-branch
git merge master
git stash pop

除了当前签出的分支以外,git中是否有办法拉出一个分支?或者有更好的方法来做到这一点?

Is there a way in git to pull a branch other than the currently checked out one, or is there a better way to do this?

例如,这就是我想要做的(再次说,我在我的分支上,想在master中合并):

For example, here's what I'd like to be able to do (again lets say I'm on my-branch and want to merge in master):

git pull master
git merge master

git-pull手册页说git pull只是一个获取操作,然后是git merge,因此除了当前已签出的分支以外,还有一种方法可以在分支上执行git pull的合并部分?

The git-pull man page says that a git pull is just a get fetch followed by a git merge, so is there a way to do the merge part of the git pull on a branch other than the one that's currently checked out?

还是我要的只是不可能?

Or is what I'm asking for just not possible?

推荐答案

尝试一下:

git pull yourRepositoryName master

这篇关于git拉到另一个分支的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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