Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to best share code with SmartGit [closed]

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?

like image 958
Eric Avatar asked Nov 17 '11 16:11

Eric


2 Answers

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.

like image 177
mstrap Avatar answered Sep 19 '22 16:09

mstrap


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

like image 35
Ian P Avatar answered Sep 20 '22 16:09

Ian P