使用源树的 git rebase

我想我对如何使用 SourceTree GUI 来做 git rebase 感到困惑。我有两个分支“主人”和“德夫”。正如我们所看到的,这两个分支分开了。我想在“ dev”分支上使用命令行进行一个 rebase,如下所示:

git checkout dev
git rebase master

enter image description here

我希望右键单击“ dev”,然后选择“ Rebase current changes into dev”。我假设当前的更改意味着“主服务器上的新提交”。但是选择这个选项似乎没有任何效果。正确的步骤是什么?

106753 次浏览

But picking this option seems have no effect whatsoever.

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

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

git checkout dev
git rebase master

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

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

Rebase current changes onto master

Howe adds in the comments:

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 $somebranch onto (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 ($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