This question already has an answer here:
I was programming for many years, but have never used a version control system. I felt, that such a system would save me a lot of time and allow me to be more productive, but I never got around to learning one, because of a lack of time that I would need to spend for learning such system.
I've finally got myself together and did a research on what VCSes exist and what are their differences. Then, I've had to work on some project, so, I've let that gathered CVS information to sink in for a few more months in my head.
While the information was sinking, I've made my choice with Git and started learning it. I've finished the book, called 'Git Magic', read many online howtos and tutorials and played with several interactive Git learning tools online. Now, I am almost finished with 'Git user manual'.
Since I don't have a real experience, except for educational in it, please advice about the better way to use git in my situations:
Let's say, I have a project (a program), that I am developing.
Over the years, it grew with its library of functions/modules.
I've started one more project (a different program), where I use the same library with those functions.
Do I make those 2 programs and the library as one git repo, since they share the same libraries?
Or split them to 3 different git repos: one for each program and one for the libraries, but then how do I test the program in the working directory or release the complete working project with all of the libraries?
Do some kind of branching that will share the same library folder, but different programs each in its own branch?
What's the best way to make those programs as individual programs, but so that they could use those libraries in each program?
Another situation is:
I have one completed project, that I vary for different purposes. I mean I have different modifications of it for a different task. So, for example, each task has the same core files, but different design. Should I use a different branch for each design, while keeping the core at its own branch, but, then how do I release or test the program in the way, so that the core joins with one of the needed designs. By design, I mean - each interface for it's core will have a different database structure, different forms, different event handlers, etc., but the same core routines.