3 users online. Create an account or sign in to join them.Users
Git and Submodules
This is an open discussion with 15 replies, filed under General.
Search
I still don’t get submodules. When I add a few lines of your example to .gitmodules both git submodule init and git submodule update don’t do anything. However when I clone Symphony from Github, both of them work…
It is a weird thing. I have the O’Reilly Git book, and it advises never to use it as it continues to change with each version…
Just thought I’d try and be helpful… ;)
PS, I’ve just tried it myself, and yeah, it don’t work… After digging a little, turns out they have to be added with git submodule add to add them to the index. Bummer.
I should never assume anything, but at least there is a quick list of some cool extensions!
Yup… I’ve just submodule-ified my first project. git rm -r and git submodule add all the way but it’s working fine now.
It took me hours to get that list together too…
- Find the extension
- Go to the Git site
- Choose the Git read-only url
- git submodule add
- do a few then git submodule update —init
- Do a commit
What a ball ache! I should learn bash and write a script to do it.
I’ve played around a little bit and it seems safe to:
- Clone the official repository
- Remove the
workspace/line from.gitignore(otherwise git will complain when you try adding it as a submodule) - Add your workspace as a submodule
- Add extensions using submodules
- Pull from the official repo for updates anytime you want
It is not okay to download the ZIP, add submodules, then add the official repo as origin and hope everything will work out. It simply won’t (you’ll end up with at least having to add all submodules again)… :-)
However I still don’t get how I can pull updates from the submodules. git submodule update apparently doesn’t do that.
I did it the same sort of way you have. I think because the submodule command is still in development and discussion in the Git community, it changes and isn’t perfect yet.
However I still don’t get how I can pull updates from the submodules. git submodule update apparently doesn’t do that.
cd into the submodule directory and git pull?
Doing that gets the entire repo, submodule only pulls the default branch, to lighten the load of your own repo.
It’s a very bizarre command, and will more than likely change very soon to something else! lol
What if you cd into the extension folder, then git init to initialise that directory’s git reference and then git pull. Not sure if that’s even possible but it sounds like it should work, since each submodule is its own repo with a .git hidden directory that can be initialised.
That’s right, and it is possible…
If you do
git submodule update --init
to pull and update all of your extensions, then like Nick said
git pull
in the extension folder you want to do detailed work on. You’ll end up in a detached head state though for the extension you’ve pulled however, so doing the first command again from the root minus the --init will revert your extension to the commit stored in your index file, as it is controlled by the main repo submodule command. It’s imperative then that you commit straight after the extension pull/fetch/checkout etc.
The other option is to just clone all the extensions you want into the /extensions folder, but that gives you a very heavy repo if you have as many extensions as I do, the entire history of every extension would be pulled down.
Yeah, git pull in each submodule actually makes perfect sense… :-)
Okay, to reiterate. After git pulling a submodule, you will see a + in front of the hash for each updated submodule in git submodule status. This tells you that you have a newer version of the submodule that hasn’t been commited yet (don’t forget to add the directory in question first).
However, when I do git submodule update again after pulling, it will create a new, unnamed branch in the submodule in question. The master branch from the latest pull will remain untouched.
Uh, god it’s complicated…
Just found this bash script recursively updating git submodules maybe it can be adapted to adde the submodules too?
has anyone figured out a good way around the issue that presents itself when switching branches that have different submodules?
for those that haven’t experienced it, if you add submodules to one branch and then checkout another branch that doesn’t have them, you will get this error:
warning: unable to rmdir extensions/dashboard: Directory not empty
this will leave all of your submodules in the file structure, but unstaged. a google search brought up this post from november:
This is because submodule deletion is not well supported at the moment. There has been a lot of discussion how to make git handle that better but no one implemented it so far.
perhaps somebody can direct me to a better method, but the context of the problem is in a repo where i have branches for both symphony-2/master and symphony-2/integration, with my own master branch being where i work. this way, i can merge either the symphony stable or the symphony rc into my branch for testing.
edit: i just realized i can’t merge symphony-2/master into my working branch if i’ve already merged integration, it says it’s already up-to-date :(
hmm, this is an interesting command
git submodule update --init --recursive
Create an account or sign in to comment.
So then, I’ve just put together my first Git repository! I don’t know why I was so hesitant to move over from Subversion, it’s a breeze (well, I guess till something goes wrong).
It has taken me an age to get all my chosen extensions under the repo as submodules, and it made me think about posting a .gitmodule file, to make it easier for others… There’s 45 extensions here, it’s not all of them. Just drop this file in place of the cloned Symphony repo’s one and
git submodule update --initand you’ll have more extensions.Hope it’s helpful?
# Symphony bundled modules [submodule "extensions/export_ensemble"] path = extensions/export_ensemble url = git://github.com/symphonycms/export_ensemble.git [submodule "extensions/markdown"] path = extensions/markdown url = git://github.com/symphonycms/markdown.git [submodule "extensions/maintenance_mode"] path = extensions/maintenance_mode url = git://github.com/symphonycms/maintenance_mode.git [submodule "extensions/selectbox_link_field"] path = extensions/selectbox_link_field url = git://github.com/symphonycms/selectbox_link_field.git [submodule "extensions/jit_image_manipulation"] path = extensions/jit_image_manipulation url = git://github.com/symphonycms/jit_image_manipulation.git [submodule "extensions/profiledevkit"] path = extensions/profiledevkit url = git://github.com/symphonycms/profiledevkit.git [submodule "extensions/debugdevkit"] path = extensions/debugdevkit url = git://github.com/symphonycms/debugdevkit.git # A bunch of other modules [submodule "extensions/subsectionmanager"] path = extensions/subsectionmanager url = git://github.com/nilshoerrmann/subsectionmanager.git [submodule "extensions/entity_diagram"] path = extensions/entity_diagram url = git://github.com/nickdunn/entity_diagram.git [submodule "extensions/datetime"] path = extensions/datetime url = git://github.com/nilshoerrmann/datetime.git [submodule "extensions/cachelite"] path = extensions/cachelite url = git://github.com/makenosound/cachelite.git [submodule "extensions/asdc"] path = extensions/asdc url = git://github.com/pointybeard/asdc.git [submodule "extensions/browsedevkit"] path = extensions/browsedevkit url = git://github.com/rowan-lewis/browsedevkit.git [submodule "extensions/collapse_fields"] path = extensions/collapse_fields url = git://github.com/6ui11em/collapse_fields.git [submodule "extensions/configuration"] path = extensions/configuration url = git://github.com/bauhouse/configuration.git [submodule "extensions/content_type_mappings"] path = extensions/content_type_mappings url = git://github.com/pointybeard/content_type_mappings.git [submodule "extensions/custompreferences"] path = extensions/custompreferences url = git://github.com/eKoeS/custompreferences.git [submodule "extensions/gcse"] path = extensions/gcse url = git://github.com/ahwayakchih/gcse.git [submodule "extensions/db_sync"] path = extensions/db_sync url = git://github.com/nickdunn/db_sync.git [submodule "extensions/datemodified"] path = extensions/datemodified url = git://github.com/czheng/datemodified.git [submodule "extensions/dump_db"] path = extensions/dump_db url = git://github.com/phoque/dump-db.git [submodule "extensions/dynamic_event_redirect"] path = extensions/dynamic_event_redirect url = git://github.com/makenosound/dynamic_event_redirect.git [submodule "extensions/email_field"] path = extensions/email_field url = git://github.com/pointybeard/email_field.git [submodule "extensions/entry_versions"] path = extensions/entry_versions url = git://github.com/nickdunn/entry_versions.git [submodule "extensions/address_field"] path = extensions/address_field url = git://github.com/jeremyboles/symphony-address_field.git [submodule "extensions/charactercounter_textinput"] path = extensions/charactercounter_textinput url = git://github.com/eoghanobrien/sym_charactercount_textinput.git [submodule "extensions/charactercounter_textarea"] path = extensions/charactercounter_textarea url = git://github.com/eoghanobrien/sym_charactercount_textarea.git [submodule "extensions/filemanager"] path = extensions/filemanager url = git://github.com/pointybeard/filemanager.git [submodule "extensions/members"] path = extensions/members url = git://github.com/symphony/members.git [submodule "extensions/image_info"] path = extensions/image_info url = git://github.com/alpacaaa/image_info.git [submodule "extensions/logsdevkit"] path = extensions/logsdevkit url = git://github.com/rowan-lewis/logsdevkit.git [submodule "extensions/markdown_guide"] path = extensions/markdown_guide url = git://github.com/wisolman/markdown_guide.git [submodule "extensions/massuploadutility"] path = extensions/massuploadutility url = git://github.com/scottkf/massuploadutility.git [submodule "extensions/mobiledevicedetection"] path = extensions/mobiledevicedetection url = git://github.com/makenosound/mobiledevicedetection.git [submodule "extensions/nestedcats"] path = extensions/nestedcats url = git://github.com/andrrr/nestedcats.git [submodule "extensions/new_entry_notice"] path = extensions/new_entry_notice url = git://github.com/wisolman/new_entry_notice.git [submodule "extensions/page_fields"] path = extensions/page_fields url = git://github.com/skeary/page_fields.git [submodule "extensions/pagesfield"] path = extensions/pagesfield url = git://github.com/pointybeard/pagesfield.git [submodule "extensions/paypal_payments"] path = extensions/paypal_payments url = git://github.com/makenosound/paypal_payments.git [submodule "extensions/publishfiltering"] path = extensions/publishfiltering url = git://github.com/nickdunn/publishfiltering.git [submodule "extensions/publish_tabs"] path = extensions/publish_tabs url = git://github.com/nickdunn/publish_tabs.git [submodule "extensions/quick_preview"] path = extensions/quick_preview url = git://github.com/icek/quick_preview.git [submodule "extensions/quickds"] path = extensions/quickds url = git://github.com/knupska/quickds.git [submodule "extensions/quickevent"] path = extensions/quickevent url = git://github.com/knupska/quickevent.git [submodule "extensions/search_index"] path = extensions/search_index url = git://github.com/nickdunn/search_index.git [submodule "extensions/section_schemas"] path = extensions/section_schemas url = git://github.com/nickdunn/section_schemas.git [submodule "extensions/sessionmonster"] path = extensions/sessionmonster url = git://github.com/pointybeard/sessionmonster.git [submodule "extensions/shopping_cart"] path = extensions/shopping_cart url = git://github.com/designermonkey/shopping_cart.git [submodule "extensions/smtp_email_library"] path = extensions/smtp_email_library url = git://github.com/pointybeard/smtp_email_library.git [submodule "extensions/static_section"] path = extensions/static_section url = git://github.com/knupska/static_section.git [submodule "extensions/wmdeditor"] path = extensions/wmdeditor url = git://github.com/dougoftheabaci/Symphony-WMD-Editor.git [submodule "extensions/xmlimporter"] path = extensions/xmlimporter url = git://github.com/rowan-lewis/xmlimporter.git