How can I get track of several projects in Git that share common code?

点点圈 提交于 2019-12-05 17:36:36

This will work.

You have to be careful with merges -- you can only merge from the common code to the client code, but you can cherry-pick individual changes back from clients to common. You'll also want to work out what your policy will be on bringing code from the common branch to the client branches -- if there's not too much client-branch code, you may be better off rebasing your client changes on top of the common code every time you want to update; with more changes it'd be a lot easier to merge the common code in.

If you go for the rebasing approach, take a look at git rerere, which is intended to help you deal with rebasing often.

If your repository is structured such that all of the common-code lives in its own separate directory, it's possible to solve this using git-submodules.

If it's the case that, instead, all of the client-customizations live in their own subdirectory I think it's possible to use the subtree merge-strategy to solve this elegantly.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!