Question

I have a number of separate projects that share some common code. What is the best practice for accomplishing this in Git, and specifically SmartGit?

  • Have everything in one giant repository

  • Have a repository for each project, and a repository for shared code, and use Git Submodules.

  • Have a repository for each project, and a repository for shared code, and use Git Subtrees. Can anyone tell me if this is supported by SmartGit, and how it can be achieved?

What are the potential pitfalls with these methods, and what are the best practices with SmartGit?

Was it helpful?

Solution

I'd recommend to either have one repository for all projects or use Submodules:

  • If your common code is closely tied together with your projects, refactorings and other kind of (API) changes of your common code will likely require changes in all of your projects, so if you can do everything with one commit in one repository, you will spend less time with doing version control (with Git). For instance, Git Submodules can't simply point to the HEAD of a branch, but only to a specific commit. It can get cumbersome to always update your submodules to the latest commit.

  • If your common code is more like an independent library and it's sufficient to update your projects from time to time with newer versions of that library, Submodules will be the better choice. They are well supported with SmartGit and having separate repositories gives you e.g. the flexibility to share only some of your repositories with others, later.

  • There is no special support for Subtrees in SmartGit.

OTHER TIPS

I'd use separate projects as well. We have hit memory issues with larger files and git + SmartGit. I'm in dialog with syntevo at the moment. With the latest version of SmartGit, the ability to copy comments is very helpful. Hope this helps

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top