git工作流:每个人都有一个分支,或者每个人都有一个高手? [英] git workflow: everyone has a branch, or everyone has a master?

查看:1678
本文介绍了git工作流:每个人都有一个分支,或者每个人都有一个高手?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当使用git与多个人一起工作时,是否更好


  1. 让每个人只需在master中工作,并在彼此的主人之间合并,或

  2. 让每个人都可以在自己的标题分支中工作?



  3. 在(1)的情况下,尽管每个主人都充当分支,但是每个人都期望彼此的工作与主流线性流合并,而在(2)中,每个人都需要将共同的主合并到他们的分支,并在他们准备就绪时将其分支中的变更推送到共同的主人。



    能否有经验在中型到大型团队中工作的人用git做任何评论?什么最适合你的团队?我猜想第三个选项是总是使用功能分支而不是人员分支,尽管我从这个问题的角度来看,它和(2)基本上是一样的情况。



    我想,在(1)和(2)中,一个人负责将变更提交给官方主人。如果超过一个人推动访问官方主人,这将如何继续?

    解决方案

git中的分支名称是本地的一个存储库。可以配置 push pull 以匹配远程存储库上的相同名称,但这是可选行为。如果你有一个中央资料库,那么你需要 master 来确定。个人开发者在其本地存储库中称他们的工作分支是真正的品味问题。一些将他们的本地 master 作为他们的工作分支,其他人将使用一个名为dev的分支。



如果你的开发人员会接受它,真正精明的方法是使用特性或主题分支,这样就不需要任何人都需要推动自动生成功能分支,而不需要每个人都需要迈克的工作分支。做一堆早期的来回合并。

When working with multiple people with git, is it better

  1. for everyone to just work in master, and merge between each other's masters, or
  2. for everyone to work in their own titled branch?

As I see it, in the case of (1), although each master acts as a branch, everyone is expected to merge between each other's work with a mostly linear flow, whereas in (2), everyone is expected to merge a common master into their branch, and push changes from their branch into a common master when they are ready.

Can someone with experience working on medium- to large-sized teams with git make any comments? What works best for your team? I guess a third option is to always use feature branches instead of people branches, although I see this as being basically the same situation as (2) from this question's point of view.

I imagine that in both (1) and (2), a single person is responsible for pulling changes to the "official" master. How would this carry over if more than one person as push access to the official master?

解决方案

Branch names in git are local to a repository. push and pull can be configured to match identical names on a remote repository, but that's optional behavior. If you have a central repository, you want master there to be definitive. What individual developers call their working branches on their local repositories is really a matter of taste. Some will have their local master be their working branch, and others will use a single named dev branch.

If your devs are up to it, the really savvy way is to use feature or topic branches, so that rather than having a "Mike's work" branch you have a "work on autofrotzification feature" branch that can be pushed and exchanged sanely without everyone needing to do a ton of early merging back and forth.

这篇关于git工作流:每个人都有一个分支,或者每个人都有一个高手?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆