单独的git存储库用于React开发(Separate git repositories for React development)

编程入门 行业动态 更新时间:2024-10-28 00:29:58
单独的git存储库用于React开发(Separate git repositories for React development)

我为我的前端团队使用create-react-app创建了一个React项目。 该团队在功能方面分为2个。 每个团队如何拥有自己的git存储库以及最终的应用程序? 我们尝试了submodules但它没有按预期工作。

I have created a React project using create-react-app for my front-end team. The team is divided into 2 in terms of functionality. How can each team have their own git repository with their own functionality and the final app is combined in the end? We tried submodules but it didn't work as expected.

最满意答案

首先,清除git中子模块的使用是很有用的。 根据官方的git 文档 。

在一个项目上工作时,经常会发生这种情况,您需要使用其中的另一个项目。

问:如果您的子项目单独有意义,则必须使用子模块(例如,每个部分都是可用于多个项目的库/项目)。 我想这不是你的情况!

此链接指出的是建议用作工作流程。 在使用之前,清除git中的分支用法很有用。 对于详细描述,你可以阅读这个链接 ,但你的情况是这样的:每个团队(甚至每个团体)都可以在分支上开发代码,并将其更改保存为顺序提交。 最后,您可以将该分支合并到另一分支以应用目标分支上的所有更改。 所以在你的情况下,每个开发团队都可以使用自己的分支(例如frontend_1 , frontend_2或backend分支)。 最后,他们可以在master上合并他们的分支以集成他们的代码。 所有这些都在一个存储库中完成(没有子模块)。

注意:如果在开发过程中同时在两个不同位置修改一个文件,则会导致冲突并必须手动解决。 这与子模块或工作流程无关。 这可能发生在pull , rebase甚至merge过程中。

At first it is useful to clear usage of submodules in git. According to official git documentation.

It often happens that while working on one project, you need to use another project from within it.

Q: If your sub-projects individually are meaningful, you must use submodules (as an example each part is a library/project which can uses in several projects). I think this is not your case!

What this link noted is a suggestion to use as workflow. Before using that it is useful to clear the branch usage in git. For an in detailed description you can read this link, but your case is this: Every team(even every body) can develop its code on a branch and save its changes as sequential commits on that. At last you can merge that branch to another one to apply all changes on target branch. So in your case each develop team can use its own branch(example frontend_1, frontend_2 or backend branches). Finally they can merge their branches on master to integrate their code. All of these done in a single repository(without submodules).

Note: If during the development one file modified at the same time in two different locations, it cause conflict and must resolve manually. This is not respect to submodules or workflow. This may occur on pull, rebase or even merge process.

更多推荐

本文发布于:2023-07-29 23:59:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1320794.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:React   git   Separate   development   repositories

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!