git rebase使用sourcetree [英] git rebase using sourcetree

查看:542
本文介绍了git rebase使用sourcetree的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我认为我对如何使用SourceTree GUI进行git rebase感到困惑.我有两个分支"master"和"dev".如图所示,这两个分支是分开的.我想使用命令行在"dev"分支上做一个基准,这将是:

I think I am confused on how to use SourceTree GUI to do git rebase. I have two branches "master" and "dev". As seen, the two branch diverged. I want to do a rebase on "dev" branch, using command line, this would be:

git checkout dev
git rebase master

我希望右键单击"dev",然后选择将当前更改重新归入dev".我认为当前的更改意味着对主服务器的新提交".但是选择此选项似乎没有任何效果.正确的步骤是什么?

I would have expected to right click "dev", and choose "Rebase current changes onto dev". I assume current changes means "new commits on master". But picking this option seems have no effect whatsoever. What would be the correct steps?

推荐答案

但是选择此选项似乎没有任何效果.

But picking this option seems have no effect whatsoever.

是的,因为当前更改是当前分支之一,即dev.

Yes, because current changes are the one of the current branches, which is dev.

dev上方重新设置dev表示无操作.

Rebasing dev on top of dev means an no-op.

git checkout dev
git rebase master

这意味着:当前分支为dev:要在master的基础上重新建立.

That means: current branch is dev: to be rebased on top of master.

因此,在SourceTree中,您需要右键单击master(在dev被检出时),然后选择:

So in SourceTree, you need to right-click on master (while dev is checked out), and select:

Rebase current changes onto master

Howe 添加

Howe adds in the comments:

"rebase current changes onto [branch]"的当前命名具有误导性.查看此改进讨论SRCTREE-1578 .

Current Naming of "rebase current changes onto [branch]" is misleading. Check out this improvement discussion SRCTREE-1578.

在发现自己困惑于尝试使功能分支随着开发和失败而更新时,我变得很困惑,我意识到,标有"rebase current changes onto $somebranch"的左窗格上下文菜单项实际上与其名称所暗示的相反:
它将当前分支重新设置为$ somebranch状态; <​​br> 换句话说,它会将$somebranch重新设置到当前分支(或当前分支)上,而不是反过来. (对吗?)

After finding myself baffled attempting to bring a feature branch up to date with development and failing, I've come to realize that the left-pane context menu item labeled "rebase current changes onto $somebranch" actually does the opposite of what its name suggests:
it rebases the current branch to the state of $somebranch;
In other words it rebases $somebranch onto (or into) the current branch, not the other way around. (Right?)

当前文本中的介词"onto"具有误导性;这意味着该句子的对象(在我的示例中为$somebranch)将接受更改.
实际上,情况恰恰相反.
当前分支名称的缺失加剧了混乱.

The preposition "onto" in the current text is misleading; it implies that the object of the sentence ($somebranch in my example) will receive the changes.
In fact, it is the opposite that will occur.
The absence of the current branch's name adds to the confusion.

重新措辞可以改善句子结构并包括受影响分支的名称,这将为澄清提供巨大的胜利.
例如:

A re-wording that improves the sentence structure and includes the name of the affected branch would afford a huge win for clarity.
For example:

rebase $currentbranch to head of $somebranch
rebase $somebranch onto $currentbranch

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

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