1

-m您能否用简单的英语解释一下,-s-X您应该传递给的论点之间有什么区别(或它们是如何工作的)git rebase

4

1 回答 1

1

这些参数不会做不同的事情,而是修改变基将如何应用更改。

http://linux.die.net/man/1/git-rebase

-m, --merge

Use merging strategies to rebase. When the recursive (default) merge strategy is used, this allows rebase to be aware of renames on the upstream side.
Note that a rebase merge works by replaying each commit from the working branch on top of the <upstream> branch. Because of this, when a merge conflict happens, the side reported as ours is the so-far rebased series, starting with <upstream>, and theirs is the working branch. In other words, the sides are swapped.

换句话说,不仅仅是在每次提交时应用更改,而是将更改合并到分支中。例如,如果一个文件被重命名,git 会对该文件进行更改,而不是创建一个新文件。

其他参数修改合并的执行方式:

-s <strategy>, --strategy=<strategy>

Use the given merge strategy. If there is no -s option git merge-recursive is used instead. This implies --merge.
Because git rebase replays each commit from the working branch on top of the <upstream> branch using the given strategy, using the ours strategy simply discards all patches from the <branch>, which makes little sense.

Git 有多种方法可以确定在合并更改时使用哪些更改。此选项指定使用哪一个。默认值为recursive,但根据具体情况,可能还有其他合适的。

-X 指定要传递给要使用的合并策略的任何附加选项。例如recursive,可以使用三个选项:ourstheirssubtree。您将使用 -X 来指定您想要的。

于 2013-08-23T15:42:52.730 回答