简体   繁体   English

单独的分支机构或git项目?

[英]Separate branches or git projects?

I'm introducing Git in our company. 我在公司介绍Git。 I have several applications that all interact together via sockets, and now, it is about to decide whether I should use 我有几个都通过套接字一起交互的应用程序,现在,将决定我是否应该使用

  • separate branches for different parts of my application, or 我的应用程序不同部分的单独分支,或者
  • separate Git projects. 单独的Git项目。

I also want to use tags for revisions; 我也想使用标签进行修订; if I use branches, I have to tag like branchnameV1.0, but if I use separate Git projects I could tag like v1.0`. 如果使用分支,则必须像branchnameV1.0, but if I use separate Git projects I could tag like那样branchnameV1.0, but if I use separate Git projects I could tag like v1.0` branchnameV1.0, but if I use separate Git projects I could tag like标记。

What would be the most conventional method for doing this? 最常规的方法是什么?

Separate Git projects: branches are interesting if you intend to merge common code source. 单独的Git项目:如果您打算合并通用代码源,则分支很有趣。

But if your apps are independent (in development, even though they are somehow linked in runtime), a git repo per application will work better. 但是,如果您的应用程序是独立的(正在开发中,即使它们在运行时以某种方式链接在一起),则每个应用程序的git repo会更好地工作。
It will allow for each app to follow its own development lifecycle, with its own set of tags and branches. 它将允许每个应用程序遵循其自己的开发生命周期,并具有自己的一组标签和分支。

If you want to keep track which versions of those three apps are, at a given time, working together, you can create a fourth repo, and register the first three as submodules . 如果要在给定的时间跟踪这三个应用程序的哪个版本可以一起工作,可以创建第四个存储库,并将前三个存储库注册为子模块

Think of branches as temporary areas for developing "Work In Progress" code that will eventually get merged back into master. 将分支视为用于开发“进行中的”代码的临时区域,这些代码最终将被合并回master。

If you have different applications, use different git projects. 如果您有不同的应用程序,请使用不同的git项目。 Git projects are cheap and everything stays a lot easier if you keep distinct degrees of separation in your workflow. 如果您在工作流程中保持不同程度的分离,那么Git项目很便宜,并且一切都变得容易得多。

In my opinion if you don't have common code between the applications it has no sense to put them on separate branches. 我认为,如果您在应用程序之间没有通用代码,则没有必要将它们放在单独的分支上。 You will never need to merge them or cherry-pick from a branch to another. 您将不需要合并它们或从一个分支到另一个分支。 I would vote for separate repos. 我会投票支持单独的回购协议。

I think that you have these options: 我认为您有以下选择:

  1. put the code at different git repositories. 将代码放在不同的git仓库中。
  2. put the code at the same git repositories, but at different directories. 将代码放在相同的git仓库中,但在不同的目录中。

I would take 1 if there are separated teams and the teams don't need/are allowed to access the others code, and the applications are independent (i personally prefer this approach, even if they are dependent). 如果有独立的团队并且不需要/不允许团队访问其他代码,并且应用程序是独立的,则我将采用1(我个人更喜欢这种方法,即使它们是依赖的)。 I would take the 2 if everybody make modifications at all application codes and they are supposed to be together ALWAYS (theres a large dependency between the applications). 如果每个人都在所有应用程序代码上进行修改并且应该总是在一起(这在应用程序之间有很大的依赖性),我将采用2。

The branching is not an option since branching is something that you do to a common code. 分支不是一种选择,因为分支是您对通用代码执行的操作。 You have a code that changed in some way (you make a branch), and then you want to merge that modifications to the main code (you merge the branch). 您有一个以某种方式更改的代码(您创建了一个分支),然后您想要将该修改合并到主代码中(您合并了分支)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM