0

When doing an interactive rebase on a feature branch, I usually want to pull only the commits that are new in that branch into the rebase, which means I need to first check my log, count the commits, and specify git rebase HEAD~n --interactive where n is the number of commits.

Is there any shortcut command to just collect the commits I want?

4

2 回答 2

1

如果我正确理解您的问题,您甚至不必担心“提交计数”将功能分支重新定位到“主”分支。

假设您有一个从前一段时间f1创建的功能分支。master如果您以后想要重新设置基准f1master假设您当前的分支是f1,您只需运行git rebase master

Git 知道何时f1master分歧,因此可以知道哪些提交必须重新基于master.

于 2013-06-07T21:22:01.140 回答
0

您可以使用git merge <feature-branch> <origin branch> 这将提供两个分支通用的最新 SHA。然后,您将能够从该提交中进行交互式变基。

于 2013-06-07T21:24:08.853 回答