Workflow to ship through Git a custom module without having every developer/server to manually load it

Hello!

(Sorry for the length but I think it could help many people, so I will take the time to explain)

My teammates and I are working on some custom developments into SugarCRM (version 7.6), and we have some trouble to understand what is the right way to work with custom module versus git.

Note that we are totally controlling all the stack from dev to production, we are hosting on-site so the application and infrastructure will be under our control. We have:

- 1 local development server in our office

- 1 aws test server

- 1 aws production server

- Each developer has it's own local setup

- We are using git, and are used to since many years (maybe its why we are getting difficulties understand the sugarcrm-gitflow, its quite unclear).

All of these environments ^ has its own database also. Nothing shared.

The problem we have: We are developping custom modules , and we want to ship these module through git only, without having to package the modules and use the "module loader" on each environment after to install them.

The reasons why we want to do this is that it doesnt make sense to us to follow a git process which implies manual action on every environment that could get our working directory dirty after (for example) a module loaded. And also, when to load a module, when to pull, in which order? You see, its very weird no? The only things that surely we have to manually deal with it is regarding the SQL for the tables "fields_meta_data" and "relationships", actually we will ship the sql changes through a custom "sql migration" directory (experimental ).

Maybe its not possible, but our best process would be: develop, commit+push, pull on environment x, fix permission, repair & rebuild, maybe run some sql => enjoy!

If possible, I just want to know how to achieve this, what we need to do under the custom folder to have our module pre-installed in the codebase.

If not possible, what could we do? The process need to be clear for custom module development with multi-enviroment, and must imply git. (And please, I don't want to get a dirty working dir after using module loader or repair/rebuild, this doesnt make sense when deploying to a server... gitignore is the solution maybe?)

*By the way, we want to be sure that we are not screwing up our SugarCRM installation, upgrade need to be possible without lot of pain, and we want to follow the best practices!

Thanks a lot for any help!

P.S. I've googled a lot since two weeks to found answer to our problem, I found some partial answers, some interesting articles, but nothing that really answer to our question)