简体   繁体   English

Git 将更新的开发分支合并到本地分支

[英]Git merge updated develop branch into local branch

How do I go about updating a branch that I have checked out, with the updated (which has had a few pull requests merged, after the local branch was branched off of develop) develop branch ?我如何更新我已经签出的分支,以及更新的(在本地分支从开发分支分支之后合并了一些拉取请求)开发分支? At the moment, if I am on branch_1 with un/committed/pushed changes, I do a目前,如果我在branch_1有未/提交/推送的更改,我会做一个

git checkout develop
git pull
git checkout branch_1
git merge develop

Is there a way with lesser steps to achieve what I am after ?有没有办法用较少的步骤来实现我所追求的?

If you want to update branch_1 via merging, then there is a slightly shorter version of doing this:如果你想通过合并更新branch_1 ,那么有一个稍微短一点的版本:

git fetch origin
git checkout branch_1
git merge origin/develop

By doing a git fetch , you automatically update the remote tracking branch for develop , which is called origin/develop .通过执行git fetch ,您会自动更新develop的远程跟踪分支,该分支称为origin/develop Note that the local branch develop would not be updated, but it doesn't matter, because you can merge with the tracking branch.注意本地分支develop不会更新,不过没关系,因为可以和tracking分支合并。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM