<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: ginwakeup</title>
    <description>The latest articles on DEV Community by ginwakeup (@ginwakeup).</description>
    <link>https://dev.to/ginwakeup</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F933479%2F0ebb4ecd-1e2c-4f37-ae92-5fc3520a1537.jpeg</url>
      <title>DEV Community: ginwakeup</title>
      <link>https://dev.to/ginwakeup</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/ginwakeup"/>
    <language>en</language>
    <item>
      <title>Submoduler: A tool to automatically keep git submodules updated through Python &amp; Docker</title>
      <dc:creator>ginwakeup</dc:creator>
      <pubDate>Thu, 29 Sep 2022 21:00:43 +0000</pubDate>
      <link>https://dev.to/ginwakeup/submoduler-a-tool-to-automatically-keep-git-submodules-updated-through-pythondocker-55mb</link>
      <guid>https://dev.to/ginwakeup/submoduler-a-tool-to-automatically-keep-git-submodules-updated-through-pythondocker-55mb</guid>
      <description>&lt;h2&gt;
  
  
  Intro
&lt;/h2&gt;

&lt;p&gt;Most of the comments I read online about git submodules go from:&lt;br&gt;
"avoid them"&lt;br&gt;
"never use submodules"&lt;br&gt;
"use one big repo"&lt;/p&gt;

&lt;p&gt;And after working with them for a year now I can understand why.&lt;/p&gt;

&lt;p&gt;I would myself suggest to stay away from submodules, as they are not exactly immediate to understand and not a nice thing to maintain either.&lt;/p&gt;

&lt;p&gt;That said, submodules &lt;strong&gt;can&lt;/strong&gt; be useful at times.&lt;/p&gt;

&lt;p&gt;For example:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;You could have multiple repositories to which you want to provide the same developer scripts. One way of achieving this could be to have them live in a separate repository and add this as a submodule.&lt;/li&gt;
&lt;li&gt;You have a very tight relationship between two repos, but at the same time you do not want (or can't) use a monorepo.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;
  
  
  Submodules in a Nutshell
&lt;/h2&gt;

&lt;p&gt;If you do not know what submodules are, they are simply links to a specific commit in another repository.&lt;/p&gt;

&lt;p&gt;That's where the trick is.&lt;/p&gt;

&lt;p&gt;Read again:&lt;br&gt;
&lt;strong&gt;They are not links to another repository&lt;/strong&gt;, they are links to a &lt;strong&gt;specific commit&lt;/strong&gt; in another repository.&lt;/p&gt;

&lt;p&gt;Let's imagine the current scenario:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;We have repository_a and repository_b&lt;/li&gt;
&lt;li&gt;We create a submodule of repository_b inside repository_a&lt;/li&gt;
&lt;li&gt;All works good, we can see repository_a in Git and it gets pulled together with repository_b.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;At some point, we might make a change inside repository_b.&lt;br&gt;
We then fetch/pull inside repository_a, and surprise: the change is not there.&lt;/p&gt;

&lt;p&gt;That's because, again, submodules point to a specific commit.&lt;/p&gt;

&lt;p&gt;The process to update a submodule is quite straight forward:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;cd repository_a
git submodule update --remote --recursive
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Great! The submodule is now updated and we see the latest changes we pushed to &lt;strong&gt;repository_b&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;What about doing this every day, every time there's a change in repository_b? &lt;br&gt;
What if repository_b is a submodule in 10/20/30 repositories?&lt;/p&gt;

&lt;p&gt;Too much work.&lt;/p&gt;

&lt;h2&gt;
  
  
  Submoduler
&lt;/h2&gt;

&lt;p&gt;That's where Submoduler comes in.&lt;/p&gt;

&lt;p&gt;Submoduler is a simple Python app that can run in a Docker Container, and loops a list of repositories provided by the user to update all of their submodules in an automatic fashion.&lt;/p&gt;

&lt;p&gt;You can find it here:&lt;br&gt;
&lt;a href="https://github.com/ginwakeup/submoduler" rel="noopener noreferrer"&gt;https://github.com/ginwakeup/submoduler&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;You can using by quickly pulling the Docker Image and running it with a simple configuration.yaml in which you can list the repositories to be updated as https urls together with options, and then run it passing a user and pat through the -env flag.&lt;/p&gt;

&lt;p&gt;Hopefully this will be of some help to someone!&lt;/p&gt;

</description>
      <category>saas</category>
      <category>discuss</category>
      <category>productivity</category>
      <category>career</category>
    </item>
  </channel>
</rss>
