How do I work on a new project and simultaneously add generic code to a base library with version control?

  softwareengineering

I work on several projects and sometimes they share a common base. How do you work with version control?

Here’s an example:

I’ve got a boilerplate WordPress plugin that I reuse. On each new WordPress plugin project I create code I want to add to my boilerplate plugin. Currently I’m manually extracting libraries & fixes and add them to my boilerplate.

Is there a better way I could do this? So when I create a new library or fix a specific bug, can I somehow say ‘this should also be added to my boilerplate repository’?

Update:

I’ve read the link, answers and comments. It gave me insight in if it’s a good idea to make a ‘mudball’ library. Reading all of it I think sometimes a common library can make sense. In my example, a ‘common base’, it makes sense to me.

But i still have my question: How do i do it? Say i have this:

  • boilerplate plugin
  • plugin 1
  • plugin 2
  • plugin 3

I decide to work on plugin 1 and write some code that would be usefull for the boilerplate plugin. Or I fix a bug in plugin 3, that also needs to be fixed in the boilerplate.

Is there a way in version control (I use netbeans / bitbucket ) to say: Commit this code to plugin 1 and also add this part to the boilerplate plugin?

3

Whether something should be in your shared library/boiler plate or not depends on the potential clients that could make good use of it. So the answer to the question “should this be in my shared bits” may very well change over time. The decision is yours. Would it make your life easier?

LEAVE A COMMENT