Git rebase master成新功能

时间:2015-11-20 04:03:20

标签: git github

我在GIT中有以下工作流程。

*Master:  feature1 -- feature2 -- hotfix1
                            \
*Feature                     tkt1

功能分支上的git rebase master给出了以下结果。

历史

tkt-1
hotfix-1
feature-2
feature-1

我预计hotfix-1将位于tkt-1之上,因为master已在newfeature分支上重新定位。

1 个答案:

答案 0 :(得分:1)

我相信您只是看到 应该从git rebase看到的结果。这就是masterfeature分支在rebase之前的样子:

master:   f1 -- f2 -- hf1
                  \
feature:            tkt1

masterfeature分支之间最近的常见提交是提交feature2。然后你做了以下事情:

git checkout feature
git rebase master

Git在master分支之上的常见f2提交后,在feature中播放了提交,然后重新提交tkt-1提交。这使您的分支看起来如下所示:

master:   f1 -- f2 -- hf1
                         \
feature:                  tkt1'   (The apostrophe indicates this is a new commit)

或者,为了使用您的符号,rebase将feature分支留下以下历史记录:

tkt-1
hotfix-1
feature-2
feature-1