简体   繁体   English

带有新模块系统客户端的git handle控件版本的Js

[英]Js with git handle control version with the new module system client side

I see that the world change and everybody include my self is working with module system like common js in the client side. 我看到世界变化,每个人都包括我自己正在使用模块系统,如客户端的常见js。 In all the tutorials and blog posts i see the method is to have one file that we import all the other files to him. 在所有教程和博客文章中,我看到方法是有一个文件,我们将所有其他文件导入他。

So for example my project is written in angular js and the files looks like this: 所以例如我的项目是用角度js编写的,文件看起来像这样:

//about/index.js //about/index.js

import AboutController from './aboutController.js';
import aboutDirective from './aboutDirective.js';

export default (app) => {
  app.controller('AboutController', AboutController);
  app.directive('about', aboutDirective);
}

//Main.js: //Main.js:

import modules from './modules';
const app = angular.module('name', modules);

import About from './components/about';
About(app);

So every feature will be added to this file and will pass the app to it. 因此,每个功能都将添加到此文件中,并将应用程序传递给它。

My question is when every person in my team works on other feature and added this feature to this Main.js file, we will always get conflicts when push this code to git. 我的问题是,当我团队中的每个人都在处理其他功能并将此功能添加到此Main.js文件中时,将此代码推送到git时,我们总会遇到冲突。

What is the solution to this approach? 这种方法的解决方案是什么?

I think your question is more about git then javascript. 我认为你的问题更多是关于git然后javascript。 But me and my colleagues use this workflow to prevent/solve the conflict: 但是我和我的同事使用这个工作流来预防/解决冲突:
1) commit: first of all commit you modify so you cannot lose that. 1)提交:首先提交你修改,这样你就不会失去它。
2) Sync your project: by a fetch you see the difference and the conflicts 2)同步您的项目:通过获取,您可以看到差异和冲突
3) Resolve the conflict: we resolve the conflict manually, when you have resolve it, and you have choose the mod to keep or discard you make another commit. 3)解决冲突:我们手动解决冲突,当你解决冲突时,你选择了mod来保留或丢弃你再做一次提交。 If you decide to take all the repos modifies you can "add to index" your file changed, then you commit again. 如果您决定采取所有repos修改,您可以“添加到索引”您的文件已更改,然后您再次提交。

We always resolve the conflicts in that way, how to prevent it? 我们总是以这种方式解决冲突,如何预防呢? you will have a conflict in the moments that someone modify your same file and: 如果有人修改同一个文件,你会发生冲突:
1) the same rows: there is no way you don't have to follow the workflow above 2) not the same rows: in this case, if you have commit before the fetch you'll not have. 1)相同的行:没有办法你不必遵循上面的工作流程2)不是相同的行:在这种情况下,如果你在提取之前提交你将没有。
hope be of somekind of help. 希望得到一些帮助。

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

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