The Artima Developer Community
Sponsored Link

Java Buzz Forum
Git Submodules: Core Concept, Workflows And Tips

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
Mathias Bogaert

Posts: 618
Nickname: pathos
Registered: Aug, 2003

Mathias Bogaert is a senior software architect at Intrasoft mainly doing projects for the EC.
Git Submodules: Core Concept, Workflows And Tips Posted: Mar 26, 2013 11:03 AM
Reply to this message Reply

This post originated from an RSS feed registered with Java Buzz by Mathias Bogaert.
Original Post: Git Submodules: Core Concept, Workflows And Tips
Feed Title: Scuttlebutt
Feed URL:
Feed Description: tech gossip by mathias
Latest Java Buzz Posts
Latest Java Buzz Posts by Mathias Bogaert
Latest Posts From Scuttlebutt

Including submodules as part of your Git development allows you to include other projects in your codebase, keeping their history separate but synchronized with yours. It’s a convenient way to solve the vendor library and dependency problems. As usual with everything git, the approach is opinionated and encourages a bit of study before it can be used proficiently. There is already good and detailed information about submodules out and about so I won’t rehash things. What I’ll do here is share some interesting things that will help you make the most of this feature. Table Of Contents Core Concept Possible Workflows Useful Tips Incoming How to swap a git submodule with your own fork How do I remove a submodule? How do I integrate a submodule back into my project? How to ignore changes in submodules Danger Zone! Pitfalls Interacting with Remotes Conclusions Core Concept First, let me provide a brief explanation on a core concept about submodules that will make them easier to work with. Submodules are tracked by the exact commit specified in the parent project, not a branch, a ref, or any other symbolic reference. They are never automatically updated when the repository specified by the submodule is updated, only when the parent project itself is updated. As very clearly expressed in the Pro Git chapter mentioned earlier: When you make changes and commit in that \[submodule\] subdirectory, the superproject notices that the HEAD there has changed and records the exact commit you’re currently working off of; that way, when others clone this project, they can re-create the environment exactly. Or in other words : \[...\] git submodules \[...\] are static. Very static. You are tracking specific commits with git submodules – not branches, not references, a single commit. If you add commits to a submodule, the parent project won’t know. If you have a bunch of forks of a module, git submodules don’t care. You have one remote repository, and you point to a single commit. Until you update the parent project, nothing changes. Possible Workflows By remembering this core concept and reflecting on it, you can understand that submodule support some workflows well and less optimally others. There are at least three scenarios where submodules are a fair choice: When a component or subproject is changing too fast or upcoming changes will break the API, you can lock the code to a specific commit for your own safety. When you have a component that isn’t updated very often and you want to track it as a vendor dependency. I do this for my vim plugins for example. When you are delegating a piece of the project to a third party and you want to integrate their work at a specific time or release. Again this works when updates are not too frequent. Credit to finch for the well-explained scenarios. Useful Tips Incoming The submodule infrastructure is powerful and allows for useful separation and integration of codebases. There are however simple operations that do not have [...]

Read: Git Submodules: Core Concept, Workflows And Tips

Topic: ARM Virtualization Extensions – Introduction (Part 1) Previous Topic   Next Topic Topic: Apache Camel meets Redis

Sponsored Links


Copyright © 1996-2018 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use