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

查看:37
本文介绍了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".我认为当前的更改意味着对 master 的新提交".但是选择这个选项似乎没有任何影响.正确的步骤是什么?

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 添加了 在评论中:

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

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

在尝试将功能分支与开发保持同步并失败后,我感到困惑,我开始意识到标有rebase current changes to $somebranch"的左窗格上下文菜单项"实际上与它的名字所暗示的相反:
它将当前分支重新设置为 $somebranch 的状态;
换句话说,它将 $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天全站免登陆