Module development workflow with GIT and modman
-
08-10-2020 - |
Question
This question is a follow up of this one: Magento 1: improving my module development workflow (Modman, composer, git)
Reminder:
I am using a bunch of extensions that me and the team I'm working with have developped (here we're talking 50+ extensions) and the code for those extensions is stored on Bitbucket
I've changed my development workflow to the following:
At the moment, when I want to add a feature/fix a bug for one of those extensions, here's my workflow:
- Install the last version of the extension on one of the website via Modman with symlinks
- Fix the bug/add a feature/test by modifying the files in
.modman
module folder - Go the
.modman
module folder and commit/push my module changes (thus the bitbucket repo for this extension will be updated) - Go back to my root folder and commit and push via GIT to the website repo
My problem now is that Assembla does not seem to recognize the symlinks from that last commit/push step.
It gives me a weird icon (like it doesn't know if it's a file or a folder):
If I check the commit here's what I see:
I'm not exactly sure what I'm missing here but when my team mates pull the repo on their side, their .modman
folder ends up being empty.
NB: something I noticed when I pushed my changes to the website repo is that I tend to get a GIT error: "fatal: git cat-file: couldn not get object info" but the commit is still pushed. I'm not sure if it's related though
Solution
It gives me a weird icon (like it doesn't know if it's a file or a folder):
It's a broken git submodule. This happens if you accidently commit a directory that contains a .git
directory.
To prevent that, use the following in your last step
git add .modman/Vendor_Module/*
The /*
adds all files in the directory, excluding those starting with a dot
Note that if you have files starting with a dot in the module's root directory (like .gitignore
) you will have to add them manually.
How to fix the broken submodules
First remove the submodule from the repository (--cached
makes sure to not change your workspace)
git rm --cached .modman/Vendor_Module
Then re-add the files as described above.