可以在此处的原始博客文章文章中找到大多数 GitFlow 工具的原始命令行建议:
https://nvie.com/posts/a-successful-git-branching-model/#incorporating-a-finished-feature-on-develop
关闭一个特性分支包括以下步骤:
$ git checkout develop
Switched to branch 'develop'
$ git merge --no-ff myfeature
Updating ea1b82a..05e9557
(Summary of changes)
$ git branch -d myfeature
Deleted branch myfeature (was 05e9557).
$ git push origin develop
SourceTree 中的复选框选项可能会执行一个额外步骤,即在合并之前将当前功能分支重新定位到开发分支的头部。如果您不熟悉git rebase 操作,我建议您先在这里阅读:
https://git-scm.com/docs/git-rebase
注意:虽然变基操作是一个完全正常的工作流程,但我几乎每天都使用它,如果您只是第一次使用它可能会导致问题,尤其是在存在冲突的情况下在您正在处理的功能分支和开发分支上的内容之间。我鼓励您单独尝试以下操作以适应正在发生的事情。
因此,从上面查看功能工作流程的“正常”完成,您将执行以下操作:
$ git checkout myfeature
Switched to branch 'myfeature'
$ git rebase develop
Replay commits from myfeature branch onto the head of the current develop branch
$ git checkout develop
Switched to branch 'develop'
$ git merge --no-ff myfeature
Updating ea1b82a..05e9557
(Summary of changes)
$ git branch -d myfeature
Deleted branch myfeature (was 05e9557).
$ git push origin develop
如果您在 rebase 操作之前和之后查看 git 存储库的历史记录,您应该希望能对正在发生的事情有所了解。如果您仍然不确定,您可能需要使用以下内容:
http://git-school.github.io/visualizing-git
这将帮助您可视化正在发生的 git 操作。