如何在一个嵌入式库中工作? [英] How to work on a drop-in library?

查看:132
本文介绍了如何在一个嵌入式库中工作?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你的平均Git新手在这里。



有时候我发现自己在我的PHP框架CodeIgniter中开发了库。在库中的放置是可以复制到新的框架安装中以便能够轻松地执行特定任务的东西。理想情况下,它不应该覆盖任何框架的文件。



现在我想让我的GitHub存储库的master分支仅包含库的文件。不过,我想维护一个开发分支,我将...开发图书馆。问题是,如果没有框架,我不能开发一个库,所以开发分支也应该有框架。现在,由于配置框架涉及的所有敏感数据(例如,用于数据库访问),我不想在GitHub上推送此分支。但是,鉴于我已经从主分支创建了开发分支,我怎样才能将我工作的文件提取到主分支?我有点困惑。



这种情况下推荐的工作流程是什么?我应该如何去做?



在此先感谢。

解决方案

两种解决方案:

1 /在修改您的开发分支时修改您的索引,以便永远不会考虑修改敏感文件

 
git update-index --assume-unchanged my / sensitive / file



<2>您使用过滤器驱动程序来生成敏感文件;





  • 模板文件(版本控制)

  • 值file(not versioned)



请参阅如何将一个文件的不同内容保存在我的本地和github存储库中?




第三个解决方案是隔离你的dropi n lib从您的框架中单独购买,并使用框架回购仅在您的磁盘上部署特定版本,然后在复制的框架内直接执行您的dropin lib回购。



您也可以通过链接这两个回购站子模块,但由于两个目录结构重叠,这更复杂。


Your average Git newbie here.

Sometimes I find myself developing drop in libraries for my PHP framework of choice, CodeIgniter. A drop in library is something that one can just copy into a fresh framework installation to be able to easily perform a specific task. Ideally it shouldn't overwrite any of the framework's files.

Now I would like the master branch of my GitHub repository to only contain the library's files. However I'd like to maintain a development branch on which I'll... develop the library. The problem is that I can't develop a library without the framework around it so the development branch should have the framework in it too. Now, because of all the sensitive data involved in configuring the framework (eg. for database access) I wouldn't like to push this branch on GitHub. But how do I "extract" the files I worked on to the master branch given that I've created the development branch from the master branch? I'm a little confused.

What's the recommended workflow in this case? How should I go about it?

Thanks in advance.

解决方案

Two solutions:

1/ you modify your index when working on your development branch in order to never consider the sensitive files modified

    git update-index --assume-unchanged my/sensitive/file

2/ You use a filter driver in order to generate the sensitive files from;

  • a template file (versioned)
  • a value file (not versioned)

See "How to keep different content of one file in my local and github repository?"


A third solution would be to isolate your dropin lib in a separate repo from your framework, and use the framework repo only to deploy on your disk a specific version, and then perform a checkout of your dropin lib repo directly within the copied framework.

You could also linked those two repos through submodules, but that is more complex as the two directory structures overlap.

这篇关于如何在一个嵌入式库中工作?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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