如何用远程主人重新绑定本地分支 [英] How to rebase local branch with remote master

查看:91
本文介绍了如何用远程主人重新绑定本地分支的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我从远程仓库的master分支克隆了项目 remote_repo 。我创建了新的分支,并向该分支提交。其他程序员推送到 remote_repo 来掌握分支。我现在需要重新分配我的分支RB到 remote_repo master。这个怎么做 ?什么命令输入终端?

I have cloned project from master branch from remote repository remote_repo. I create new branch and I commit to that branch. Other programmers pushed to remote_repo to master branch. I need now to rebase my branch RB onto remote_repo master. How to do this ? What commands to type to terminal ?

推荐答案

首先从上游存储库中获取新的主服务器,然后重新绑定您的工作分支:

First fetch the new master from the upstream repository, then rebase your work branch on that:

git fetch origin            # Updates origin/master
git rebase origin/master    # Rebases current branch onto origin/master

更新:请参阅提供了一个更简洁的方式来做同样的事情 - 最近的Git版本提供了一种更简单的方法来完成上述两个命令的等效操作。

Update: Please see Paul Draper's answer for a more concise way to do the same - recent Git versions provide a simpler way to do the equivalent of the above two commands.

这篇关于如何用远程主人重新绑定本地分支的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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