开发者

How to work on a drop-in library?

开发者 https://www.devze.com 2023-04-03 08:28 出处:网络
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 fram

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 l开发者_Python百科ibrary. 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;

How to work on a drop-in library?

  • 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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号