git - 在功能分支上团队工作的最佳实践是什么?

use*_*018 5 git branching-and-merging

我们有以下分支机构:
masterdevelop.
我们创建了一个新的分支机构feature,develop并指派了一个团队来处理它.
在开发期间:

  • 远程develop接受其他团队的新提交.
  • remote feature接受由其工作的团队成员推送的新提交.

有时develop需要更新热门修复程序feature.
当然,在周期结束时,feature应该合并到develop.

我们没有单一的工作流程来保持feature和它的本地副本同步develop,然后确保所有本地副本都基于相同的提交.

我建议的工作流程如下:

与时俱进 develop

  1. 新的提交被推到了 develop
  2. 我重新feature分支:

    git checkout feature
    git pull --rebase origin develop
    git push origin feature
    
    Run Code Online (Sandbox Code Playgroud)
  3. 所有本地feature副本运行:git pull --rebase origin feature

feature从本地副本更新分支

  1. 团队成员已经完成了他在feature分支机构的工作
  2. 他确保他的本地副本是最新的: git pull --rebase origin feature
  3. 他将他的提交合并到feature:

    git checkout feature
    git pull origin feature
    git merge local-feature
    git push origin feature
    
    Run Code Online (Sandbox Code Playgroud)

feature分支合并到develop

  1. 我确保功能是最新的develop:

    git checkout feature
    git pull --rebase origin develop
    
    Run Code Online (Sandbox Code Playgroud)
  2. 我合并成develop:

    git checkout develop
    git pull origin develop
    git merge feature
    git push origin develop
    
    Run Code Online (Sandbox Code Playgroud)

我们完成所有pull --rebase这些工作以保持线性流量,并确保使用快进合并所有更改.
但是,正如您所知,每次都有很多命令可以运行.

这真的有必要吗?我们是以"正确"的方式做到这一点吗?
你会建议另一个流程吗?

Wil*_*sem 4

我假设您遵循此模型:http ://nvie.com/posts/a-successful-git-branching-model/

在此输入图像描述

我认为大多数演示的命令都是正确的,但是您可以通过实施git alliases使事情变得更容易