Reputation: 799
I am working on a Python library that I use at work but also for my personal projects and I want to store it in git. I am trying to keep the differences only in few sepparate files, for example: - file a, b, c will only exist in work project - file x, y, z will only exist in the personal project All the other will be the same and share the same evolution.
What's the best strategy to having this with git? Preferably, the history for those files will also be kept sepparate.
Upvotes: 0
Views: 24
Reputation: 17292
I'd suggest treating it more like a shared library - any file that differs between work and home should be kept in a separate repository entirely. Then this isn't a problem.
However, if you don't want to do that, simply use a different branch. For example, let master
represent what you have at work. Create a home
branch and in your home branch delete files a, b, and c, and create files x, y, and z. Make all your changes in master. You can merge from master to home whenever you want, but not the other way around (although you could do a cherry-pick, but that's more advanced).
Upvotes: 1