<?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: Chris Tooley</title>
    <description>The latest articles on DEV Community by Chris Tooley (@ctooley).</description>
    <link>https://dev.to/ctooley</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%2F11673%2F2761543.jpeg</url>
      <title>DEV Community: Chris Tooley</title>
      <link>https://dev.to/ctooley</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/ctooley"/>
    <language>en</language>
    <item>
      <title>Merging old repos into a monolithic git repo archive</title>
      <dc:creator>Chris Tooley</dc:creator>
      <pubDate>Tue, 11 Jul 2023 23:51:19 +0000</pubDate>
      <link>https://dev.to/ctooley/merging-old-repos-into-a-monolithic-git-repo-archive-4c7h</link>
      <guid>https://dev.to/ctooley/merging-old-repos-into-a-monolithic-git-repo-archive-4c7h</guid>
      <description>&lt;p&gt;I needed to archive some old repositories into a monorepo and of course I gave myself the requirement of maintaining git history, in some way. I tried a couple of solutions but it wasn't until I stumbled upon the &lt;code&gt;git-filter-repo&lt;/code&gt; project at &lt;a href="https://github.com/newren/git-filter-repo"&gt;https://github.com/newren/git-filter-repo&lt;/a&gt; and another article which I've since lost (which was badly documented anyway) that I was able to figure out how to do this.&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--7R8_QUbb--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/f0zm4rjkgoxw4jtx59ny.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--7R8_QUbb--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/f0zm4rjkgoxw4jtx59ny.png" alt="Branch representation" width="422" height="813"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The basic steps are as follows:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;clone the repositories to be archived into a fresh directory&lt;/li&gt;
&lt;li&gt;modify each repository so that its source code is placed in a common directory name (I chose &lt;code&gt;sources&lt;/code&gt;)&lt;/li&gt;
&lt;li&gt;import the repositories as a remote git repo&lt;/li&gt;
&lt;li&gt;merge the "remote" repo branches into the appropriate branches&lt;/li&gt;
&lt;li&gt;done&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Here are the actual steps I ran:&lt;/p&gt;
&lt;h2&gt;
  
  
  setup
&lt;/h2&gt;


&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;mkdir &lt;/span&gt;oldapps
&lt;span class="nb"&gt;mkdir &lt;/span&gt;legacy_tools
&lt;span class="nb"&gt;cd &lt;/span&gt;legacy_tools &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; git init &lt;span class="c"&gt;#or init with github in whatever way suits you&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;h2&gt;
  
  
  process
&lt;/h2&gt;


&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;cd &lt;/span&gt;oldapps
git clone git@old/repo/location/old-repo.git old-repo
&lt;span class="nb"&gt;cd &lt;/span&gt;old-repo
git checkout master &lt;span class="c"&gt;#might not be needed, might be main&lt;/span&gt;
git filter-repo &lt;span class="nt"&gt;--to-subdirectory-filter&lt;/span&gt; sources/old-repo &lt;span class="nt"&gt;--tag-rename&lt;/span&gt; :old-repo-
&lt;span class="c"&gt;# git filter-repo --force --to-subdirectory-filter sources/old-repo --tag-rename :old-repo-&lt;/span&gt;
&lt;span class="nb"&gt;cd&lt;/span&gt; ../../legacy_tools
git remote add &lt;span class="nt"&gt;-f&lt;/span&gt; &lt;span class="nb"&gt;local&lt;/span&gt; ../oldapps/old-repo/
git merge &lt;span class="nt"&gt;--allow-unrelated-histories&lt;/span&gt; &lt;span class="nb"&gt;local&lt;/span&gt;/master
&lt;span class="c"&gt;# maybe also do for develop or other branches as necessary&lt;/span&gt;
&lt;span class="c"&gt;# git checkout develop&lt;/span&gt;
&lt;span class="c"&gt;# git merge --allow-unrelated-histories local/develop&lt;/span&gt;
git push origin main
git remote &lt;span class="nb"&gt;rm local&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;Repeat the above for all repos you want to archive and Bob's your uncle. &lt;/p&gt;
&lt;h2&gt;
  
  
  breakdown of steps
&lt;/h2&gt;


&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;cd oldapps
git clone git@old/repo/location/old-repo.git old-repo
cd old-repo
git checkout master #might not be needed, might be main
git filter-repo --to-subdirectory-filter sources/old-repo --tag-rename :old-repo-
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;This is you going into your "oldapps" repo, and modifying a fresh checkout of your repo such that all the code gets placed into a &lt;code&gt;sources&lt;/code&gt; directory in &lt;code&gt;oldapps&lt;/code&gt;. When the above is run the directory structure looks somewhat like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;.
├── old-repo
│   └── sources
│       └── old-repo
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;So old-repo now has a directory with &lt;code&gt;sources&lt;/code&gt; and &lt;code&gt;old-repo&lt;/code&gt; &lt;em&gt;within that&lt;/em&gt; contains all the actual code.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;cd ../../legacy_tools
git remote add -f local ../oldapps/old-repo/
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Next we go back to the &lt;code&gt;legacy_tools&lt;/code&gt; repository (the monorepo in which we're archiving all our old repos) and we set a remote to the local repository we just modified.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git merge --allow-unrelated-histories local/master
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The above then merges the &lt;code&gt;master&lt;/code&gt; (or &lt;code&gt;main&lt;/code&gt;, our code was so old the main branch was called &lt;code&gt;master&lt;/code&gt;) into the current branch you're in on &lt;code&gt;legacy_tools&lt;/code&gt;. I also suggest making new branches that correspond to the names of the old repos and keeping that around too.&lt;/p&gt;

&lt;p&gt;The last steps are just removing the &lt;code&gt;local&lt;/code&gt; remote source and pushing to origin if you have it.&lt;/p&gt;

&lt;p&gt;Why did I do this? Dunno man, it was asked of me and I found it interesting.&lt;/p&gt;

&lt;h2&gt;
  
  
  caveats
&lt;/h2&gt;

&lt;p&gt;This merges all the historical git commits - if this doesn't work for you, then you should really question how you could do this without merging the commits (hint: it's not possible!). I was told I could archive without git history so I wasn't particularly bent out of shape, I have the logs, who cares whether the history is mixed?&lt;/p&gt;

&lt;p&gt;This also is not going to work great if you're going to be merging code from branch to branch in &lt;code&gt;legacy_tools&lt;/code&gt; but... Why are you archiving the code then?&lt;/p&gt;

&lt;p&gt;I'm also not going to say I'm a git expert either but this seems to have done the job for me! Hope this helps someone in the future.&lt;/p&gt;

</description>
      <category>git</category>
      <category>archiving</category>
      <category>development</category>
    </item>
    <item>
      <title>Bring back the Deeplink</title>
      <dc:creator>Chris Tooley</dc:creator>
      <pubDate>Fri, 07 Jul 2023 22:44:14 +0000</pubDate>
      <link>https://dev.to/ctooley/bring-back-the-deeplink-4ian</link>
      <guid>https://dev.to/ctooley/bring-back-the-deeplink-4ian</guid>
      <description>&lt;p&gt;I have a bone to pick with most of you, and it has to do with being able to link to specific parts of a page, which I know as deeplinks, and I hope most of you know it too, but this is apparently a weird, unknown quirk of the "old net", given that I keep having to describe it to colleagues/clients/friends/children/neighbour's dogs/etc. To me, it seems obvious, like a pi symbol for a link to a secret administration panel. To those of you already on the deeplink train, I salute you, my droogs. Those of you who aren't, &lt;em&gt;why I oughtta&lt;/em&gt;.&lt;/p&gt;

&lt;p&gt;It used to be, long ago, &lt;em&gt;in the before times&lt;/em&gt;, when the internet was young and fresh faced, a page would have a few grainy images, and mostly text, because that was the style of the time.  According to one's whims, one could send a link to a page to their compatriot, and reference an anchor element by its &lt;code&gt;id&lt;/code&gt; attribute, and we would share the links with others via email, after they'd &lt;em&gt;dial their goddamn ISP for internet&lt;/em&gt;, and they'd visit the link we sent, and their browser would "zip" right to the section at which we wanted their eyes to gander.&lt;/p&gt;

&lt;p&gt;"Gaze ye upon yonder page, specifically the part where it says you're wrong and you suck"&lt;/p&gt;

&lt;p&gt;This was good and beneficial. You could have a long page of text, click on a link to an internal anchor element, and just copy the URL which contained that &lt;code&gt;id&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;It would look something like:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;http://example.com/ye_olde_directory.html#SectionWhereItSaysYouAreDumb
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;My chums. My friends. My digital co-citizens of the boiling flesh of the yog-sothothian internet.&lt;/p&gt;

&lt;p&gt;In a small, crystalline way, deeplinking is glorious; it is lovely. We have something good, and pure, and so, so useful.&lt;/p&gt;

&lt;p&gt;It is as a beautiful alpine flower: rare, yes, but when you encounter it, it is a moment of happiness, a point of clarity in an otherwise murky barren hilltop. Search within yourself, you know it to be true! And, just like the alpine flower iridescent against a mottled, grey and brown rocky outcropping, it would grasp at your attention. "Hey numbnuts! Get a load of this!" it beckons.&lt;/p&gt;

&lt;p&gt;Where did those deeplinks go? I mean, yeah, I encounter it still (often in places like documentation, which is &lt;em&gt;good&lt;/em&gt;! I like that! &lt;em&gt;Keep doing that!&lt;/em&gt;), but it's more often the case that developers &lt;em&gt;don't&lt;/em&gt; implement deeplinks than if they do! Can you link to a specific song section in spotify? The specific paragraph in that article where your buddy is proven wrong? Is it obvious how to do so? Can you link to a specific element in your settings page for your SPA? Can you link to a specific spot on your mapbox implementation, replete with whatever information you wish to present to someone else? Let your imagination flourish and blossom! The world wide web is your oyster! &lt;/p&gt;

&lt;p&gt;This was a part of the promise of URLs - the promise of a &lt;em&gt;specific thing&lt;/em&gt; on the web. The promise that you'd have something of note behind that abyssal, guttural combination of grunted alphanumerics, like summoning into the air a digital daemon through the ephemeral folds of space time, to laugh and gesture with malice to what we seek.&lt;/p&gt;

&lt;p&gt;As the internet has matured into it's roiling fleshy mass of tentacles and unspeakable horrors and anguish, we now have copious media like video, pictures, and audio, unlike what we used to have. We should be able to do much more with our URLs as well. We should be able to reference very specific things. Why wouldn't a frame be something you can reference? Why wouldn't a &lt;em&gt;pixel&lt;/em&gt; or &lt;em&gt;set of pixels&lt;/em&gt; be something you could link to? &lt;/p&gt;

&lt;p&gt;Well... maybe that's without reason.&lt;/p&gt;

&lt;p&gt;But please, if you are a web developer you should be giving serious consideration to implementing deeplinking in some way in all your websites. Even if it's just as a callback to ages gone by, by adding ids to anchors in headers.&lt;/p&gt;

&lt;p&gt;But in fact, with our new technologies, we should be able to deeplink to more elements than just anchor elements. I know, because I can implement this, &lt;em&gt;typically&lt;/em&gt;, without too much hassle.&lt;/p&gt;

&lt;p&gt;Oh, you're making a SPA? It doesn't matter, listen to the hash, and try to find the element with that id to scroll to. There's no excuse! Just do the thing!&lt;/p&gt;

&lt;p&gt;You may be thinking this is some dork-ass loser thing that not many people will use, but &lt;em&gt;you&lt;/em&gt; can use it when you are helping someone find something, fellow dork-ass loser! How many times have you had to &lt;em&gt;describe with excruciating detail&lt;/em&gt; what element a person should click on to navigate to a specific section of a page? Imagine, instead, a way to send the user to the specific section, and, heck, maybe even &lt;em&gt;highlighting&lt;/em&gt; the section. &lt;/p&gt;

&lt;p&gt;Google maps has deeplinking, Wikipedia has deeplinking. Shouldn't you? Make it an &lt;em&gt;ur-URL&lt;/em&gt;, give it a &lt;em&gt;hash-crown&lt;/em&gt;, and let your pages blossom with the phenomenal cosmic power of deeplinks.&lt;/p&gt;

&lt;p&gt;When we ask, like the fabled Peter Potamus, "Did you get that thing I sent you?", you should be able to say with a twinkle in your eyes: "yes".&lt;/p&gt;

</description>
      <category>web</category>
      <category>usability</category>
      <category>deeplinks</category>
      <category>knowledgeoftheancients</category>
    </item>
    <item>
      <title>Chris Tooley</title>
      <dc:creator>Chris Tooley</dc:creator>
      <pubDate>Thu, 16 Mar 2017 20:10:29 +0000</pubDate>
      <link>https://dev.to/euxneks/chris-tooley</link>
      <guid>https://dev.to/euxneks/chris-tooley</guid>
      <description>

</description>
      <category>softwaredeveloper</category>
      <category>canada</category>
      <category>python</category>
      <category>php</category>
    </item>
  </channel>
</rss>
