git rebase 使用 sourcetree

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/39928132/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-09 04:32:53  来源:igfitidea点击:

git rebase using sourcetree

gitatlassian-sourcetree

提问by python152

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:

我想我对如何使用 SourceTree GUI 进行 git rebase 感到困惑。我有两个分支“master”和“dev”。正如所见,这两个分支是分开的。我想使用命令行对“dev”分支进行变基,这将是:

git checkout dev
git rebase master

enter image description here

在此处输入图片说明

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?

我本来希望右键单击“dev”,然后选择“将当前更改重新设置为 dev”。我认为当前的更改意味着“对 master 的新提交”。但是选择这个选项似乎没有任何影响。什么是正确的步骤?

回答by VonC

But picking this option seems have no effect whatsoever.

但是选择这个选项似乎没有任何影响。

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

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

Rebasing devon top of devmeans an no-op.

衍合dev上的顶部dev的装置的无操作。

git checkout dev
git rebase master

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

这意味着:当前分支是dev: 重新基于master.

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

所以在SourceTree中,你需要右键点击master(while devis check out),然后选择:

Rebase current changes onto master

Howeadds in the comments:

Howe在评论中补充道:

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

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 $somebranchonto (or into) the current branch, not the other way around. (Right?)

The preposition “onto” in the current text is misleading; it implies that the object of the sentence ($somebranchin 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

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

在发现自己试图将功能分支与开发保持同步并失败后感到困惑后,我开始意识到标有“ rebase current changes onto $somebranch”的左窗格上下文菜单项实际上与其名称所暗示的相反:
它重新设定当前分支的基础到 $somebranch 的状态;
换句话说,它基于$somebranch(或进入)当前分支,而不是相反。(对?)

onto当前文本中的介词“ ”具有误导性;这意味着句子的对象($somebranch在我的示例中)将收到更改。
事实上,情况恰恰相反。
当前分支名称的缺失增加了混乱。

改进句子结构并包括受影响分支名称的重新措辞将为清晰起见提供巨大的胜利。
例如:

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