Best practice for managing project variants in Git?

前端 未结 5 2093
闹比i
闹比i 2020-12-31 11:58

I have to develop two Django projects which share 90% of the same code, but have some variations in several applications, templates and within the model itself.

I\'m

相关标签:
5条回答
  • 2020-12-31 12:30

    Considering it is a Django / Pinax site, with variants scattered around inside several different applications, I would not recommend using submodules.

    The variants should be managed independently in project1 branch and project2 branch, removing the need to "filter" a gitignore result.

    If you identify some really common codes, they may end up in a third repo you could then "subtree merged" to project1 and project2 repositories (the meaning of subtree merge strategy being illustrated in this SO answer)

    0 讨论(0)
  • 2020-12-31 12:35

    I would try submodules: http://www.kernel.org/pub/software/scm/git/docs/user-manual.html#submodules

    0 讨论(0)
  • 2020-12-31 12:37

    You can use two different git branches for development. When you make changes in one that are common to the other, just git-cherrypick them over. You can push and pull specific branches, too, so that no one ever need know you're working on both of them at the same time.

    0 讨论(0)
  • 2020-12-31 12:39

    Move the common code to its own library and make it a dependency of those two projects. This is not a question of version control, but a question of code reuse, design and eliminating duplication.

    0 讨论(0)
  • 2020-12-31 12:44

    I would make a third repo where I would place the code that Projects share. Then Project1 and Project2 would have their own repo and they can pull from that "shared" third repo.

    I think that your idea of "filtered pull" will make it difficult to mantein.

    0 讨论(0)
提交回复
热议问题