开发者

How to manage multiple similar but different projects with git?

开发者 https://www.devze.com 2023-03-20 17:03 出处:网络
I have multiple different closed source projects based on a similar code base and every single day I need to copy changes and fixes from one to another and back.

I have multiple different closed source projects based on a similar code base and every single day I need to copy changes and fixes from one to another and back.

As some of my projects are diverged too much to use git submodules and in others I don't want my clients mess with submodules and consequently pee开发者_开发问答k into my work on other projects now I do that with git patch and git apply which is a tedious job.

I am about to consider a switch to git pull and git push between local repositories on my machine consequently using git cherry-pick and git merge to pick up needed changes, but if there is a better way?


The following are more like suggestions

Subtree merging

Stitching together repositories

I'm really interested also in this and I'll come with an update if I get to any definitive answer.


Using git cherry-pick may do what you want. By having the other repository as a remote you can fetch from, you can still cherry-pick single commits. You don't have to create a branch of the remote either, just fetch in the changes and cherry-pick the sha1 of the commit you're wanting to port. When you push, it shouldn't push the other fetched references, as they're not on your current branch, just the cherry-picked commit is.

0

精彩评论

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