团队协作 - 在git flow中如果有人需要我写的feature作为依赖怎么办?
伊谢尔伦
伊谢尔伦 2017-05-02 09:28:14
0
3
783

例如,我在开发 feature/user 用户管理模块,提供用户的名称,信息等等, 我的同事在开发 feature/login 登录系统,他需要我的用户模块来检测是否可以登录,获取用户信息等等。

问题1:

假设我已经完成了用户系统,那么怎么给我的同事让他使用?

难道是我先 finish, 同事再 finish, 同事再 start 么?不太现实。

问题2:

假设我没有完成用户系统,但是我完成了同事所需要的内容,那怎么给他使用?

难道是我先 finish, 同事再 finish, 我和同事再 start,分别继续开发么?

这些有什么好的解决方案么?


补充:首先主要是时间太紧张了,一个人肯定写不来,所以要多个人一起,可是多个人又会牵扯依赖问题。所以想知道如何解决这个问题。

伊谢尔伦
伊谢尔伦

小伙看你根骨奇佳,潜力无限,来学PHP伐。

reply all(3)
巴扎黑

Since you did not mention whether you are developing under the same project; I will assume that you are working on the same project. Before explaining what I mean, please take a look at the following points to see if you are clear about them:

  1. The nodes of git are equal

  2. git supports ssh, http, file and other protocols

My suggestion:

Suppose John and Jane collaborate on the same project;

  • John creates a project demo, which is in his personal directory;

cd /home/John/demo/; 
git init
git add .
git commit;
  • If Jane and John are on the same development machine, then she can clone John’s code directly in her home

git clone /home/John/demo/ #Jane应该具有该目录的权限
  • Now John can continue to develop, Jane can also continue to develop, and both of them can continue to submit;

git commit #John
git commit #Jane
  • Since Jane directly cloned John's code, git naturally records the address of another developer in Jane's directory. Its name is remote, and the specific content is in .git/config. The configuration field name is origin; Jane
    can directly pull all updates from the origin source into her own code;

git pull --rebase origin
  • The question is, what if John also needs Jane’s code? Since John’s git project does not have any other development node information, he needs to add it manually; after adding it, he can pull Jane’s updates at any time;

git remote add jane /home/Jane/demo/
git pull --rebase jane
  • Now John and Jane can pull each other’s code into their own folders; develop happily;

小葫芦

I think this requirement conflicts in terms of division of labor
One module is strongly dependent on another module, so it must wait for it

So refine your needs
After the User module is completed, you can submit it
At this time, you branch your module and continue
Your colleague branches his module and continues

This is standard procedure

There is a concept called continuous integration. The earlier you perform integration operations, the better it will be for your code.
The concept that extends downwards is called continuous delivery, which is all designed to cope with this kind of environment. You can refer to it

我想大声告诉你

For this situation I recommend this method:

From feature/user 分支上开出一个新的分支 feature/user_login
feature/user 开发进入到可用的阶段时, 把代码往 feature/user_login 上合并
这样 feature/user_login 可以直接进行测试
feature/user_login 开发完毕后,合并到 feature/user
最后 finish feature/user

This is how feature/user_login 作为 feature/user 的一个子功能开发的
如果再做功能的时候不是这样设计的, 那最好还是将 feature/user finish 后再开发 feature/login

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template