<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[All Systems Go]]></title><description><![CDATA[All Systems Go]]></description><link>https://blog.joelcolaco.com</link><image><url>https://cdn.hashnode.com/res/hashnode/image/upload/v1628970964147/Ts7o-2nJP.png</url><title>All Systems Go</title><link>https://blog.joelcolaco.com</link></image><generator>RSS for Node</generator><lastBuildDate>Sun, 26 Apr 2026 19:41:10 GMT</lastBuildDate><atom:link href="https://blog.joelcolaco.com/rss.xml" rel="self" type="application/rss+xml"/><language><![CDATA[en]]></language><ttl>60</ttl><item><title><![CDATA[Moving Code from One Repository to Another Using Git Patch]]></title><description><![CDATA[Sometimes, you may need to move some code from one repository to another, without preserving the commit history or merging the entire branches. This can be useful when you want to reuse some code snippets, refactor your codebase, or migrate to a new ...]]></description><link>https://blog.joelcolaco.com/moving-code-from-one-repository-to-another-using-git-patch</link><guid isPermaLink="true">https://blog.joelcolaco.com/moving-code-from-one-repository-to-another-using-git-patch</guid><category><![CDATA[Git]]></category><category><![CDATA[software development]]></category><dc:creator><![CDATA[Joel Colaco]]></dc:creator><pubDate>Thu, 25 Jan 2024 20:43:02 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1705895907144/a2d56b85-ff1a-4f23-a6b2-2263b7de538a.jpeg" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>Sometimes, you may need to move some code from one repository to another, without preserving the commit history or merging the entire branches. This can be useful when you want to reuse some code snippets, refactor your codebase, or migrate to a new repository. In this post, I will show you how to do this using git patch, a handy feature that allows you to create and apply patch files that contain the differences between two versions of code.</p>
<h2 id="heading-step-1-clone-the-source-repository-and-make-sure-you-have-the-latest-code">Step 1: Clone the source repository and make sure you have the latest code</h2>
<p>The first step is to clone the repository that contains the code you want to move. For example, let's say you want to move some code from repo1 to repo2. You can clone repo1 using the following command:</p>
<pre><code class="lang-bash">git <span class="hljs-built_in">clone</span> https://github.com/user/repo1.git
</code></pre>
<p>Then, you can change to the directory of repo1 and make sure you have the latest code by pulling from the remote branch. For example, if you want to move code from the master branch, you can do:</p>
<pre><code class="lang-bash"><span class="hljs-built_in">cd</span> repo1
git pull origin master
</code></pre>
<h2 id="heading-step-2-create-a-patch-file-using-git-show-command">Step 2: Create a patch file using git show command</h2>
<p>The next step is to create a patch file that contains the changes you want to move. A patch file is a text file that shows the differences between two versions of code, using the unified diff format. You can create a patch file using the git show command, which shows the changes introduced by a specific commit. For example, if you want to move the code from the commit with the hash 123456, you can do:</p>
<pre><code class="lang-bash">git show 123456 &gt; mypatch.patch
</code></pre>
<p>This will create a file named mypatch.patch in the current directory, which contains the changes from the commit 123456. You can also use other options with the git show command, such as --stat to show the statistics of the changes, or --name-only to show only the names of the files changed. You can also create a patch file from multiple commits, using the git format-patch command. For more details, check out the git documentation.</p>
<h2 id="heading-step-3-clone-the-destination-repository-and-create-a-new-branch">Step 3: Clone the destination repository and create a new branch</h2>
<p>The third step is to clone the repository where you want to move the code. For example, you can clone repo2 using the following command:</p>
<pre><code class="lang-bash">git <span class="hljs-built_in">clone</span> https://github.com/user/repo2.git
</code></pre>
<p>Then, you can change to the directory of repo2 and create a new branch where you will apply the patch. It is a good practice to create a new branch for applying patches, so that you can easily revert or modify the changes if needed. For example, you can create a new branch named patch-branch using the following command:</p>
<pre><code class="lang-bash"><span class="hljs-built_in">cd</span> repo2
git checkout -b patch-branch
</code></pre>
<h2 id="heading-step-4-apply-the-patch">Step 4: Apply the patch</h2>
<p>The final step is to apply the patch file to the destination repository. You can do this using the git apply command, which applies a patch to the current working directory. For example, you can apply the patch file mypatch.patch that you created in step 2 using the following command:</p>
<pre><code class="lang-bash">git apply mypatch.patch
</code></pre>
<p>However, this command may fail if there are conflicts or differences between the source and destination repositories. For example, the patch may try to modify a file that does not exist, or a line that has been changed in the destination repository. In this case, you can use the --reject parameter, which allows you to apply the patch partially, and handle the parts that do not apply manually. For example, you can do:</p>
<pre><code class="lang-bash">git apply --reject mypatch.patch
</code></pre>
<p>This will apply the patch as much as possible, and create a .rej file for each file that has conflicts or differences. The .rej file contains the parts of the patch that did not apply, and you can review them using a text editor or a code editor. For example, using VS Code gives you a better view that colors the code for added/removed code green/red. You can then edit the files and resolve the conflicts or differences, and delete the .rej files when you are done.</p>
<h2 id="heading-step-5-commit-and-push-the-changes-to-the-destination-repository">Step 5: Commit and push the changes to the destination repository</h2>
<p>Once you have applied the patch and resolved any conflicts or differences, you can commit and push the changes to the destination repository. For example, you can do:</p>
<pre><code class="lang-bash">git add .
git commit -m <span class="hljs-string">"Applied patch from repo1"</span>
git push origin patch-branch
</code></pre>
<p>This will commit and push the changes to the branch patch-branch in the remote repository. You can then create a pull request to merge the changes to the main branch, or any other branch you want. This method does not care particularly about the history from the previous repository, and it will be wiped away when a new pull request is created in the new repository.</p>
<h2 id="heading-conclusion">Conclusion</h2>
<p>In this post, I showed you how to move code from one repository to another using git patch, a handy feature that allows you to create and apply patch files that contain the differences between two versions of code. This can be useful when you want to reuse some code snippets, refactor your codebase, or migrate to a new repository. I hope you found this post helpful and learned something new. If you have any questions or feedback, feel free to leave a comment below. Happy coding! 😊</p>
]]></content:encoded></item><item><title><![CDATA[Demystify DNS - Tldr]]></title><description><![CDATA[While setting up my blog I came across having to setup DNS entries for Github as well as Hashnode simultaneously. After reading about CNAME and A records I thought it would be fitting to do a short article on the subject.
What is DNS?
The Domain Name...]]></description><link>https://blog.joelcolaco.com/demystify-dns-tldr</link><guid isPermaLink="true">https://blog.joelcolaco.com/demystify-dns-tldr</guid><category><![CDATA[dns]]></category><category><![CDATA[networking]]></category><category><![CDATA[internet]]></category><category><![CDATA[newbie]]></category><dc:creator><![CDATA[Joel Colaco]]></dc:creator><pubDate>Fri, 20 Aug 2021 01:53:33 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1629409203237/UpGdEBhFf.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>While setting up my blog I came across having to setup DNS entries for Github as well as Hashnode simultaneously. After reading about CNAME and A records I thought it would be fitting to do a short article on the subject.</p>
<h2 id="what-is-dns">What is DNS?</h2>
<p>The Domain Name System (DNS) is analogous to a phonebook for the Internet. It lists domain names with their corresponding IP addresses (DNS Record).</p>
<h2 id="why-do-we-need-dns">Why do we need DNS?</h2>
<p>It would be extremely tedious to remember and enter IP addresses for our favorite websites. Domain names were born to solve this problem by using letters rather than numbers allowing users to select easy to remember domain names for their websites. DNS is used to translates these domain names to IP addresses and eliminates the need for us to memorize any IP addresses.</p>
<h2 id="how-does-dns-work">How does DNS work?</h2>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1629415712987/PC1fDtcoB.png" alt="DNS Flow (1).png" /></p>
<ol>
<li><p>The domain ‘joelcolaco.com’ is typed into a web browser and a DNS query is sent to the DNS resolver.</p>
</li>
<li><p>The resolver queries a DNS root nameserver.</p>
</li>
<li><p>The root nameserver responds to the resolver with the address of a Top Level Domain (TLD) DNS server. (In this example the .com TLD)</p>
</li>
<li><p>The resolver makes a request to the .com TLD DNS server.</p>
</li>
<li><p>The TLD DNS server responds with the IP address of the domain’s nameserver.</p>
</li>
<li><p>The resolver sends a query to the Authoritative name server (domain’s nameserver). This is where if a zone file exists with a:</p>
<ul>
<li>CNAME - a subdomain/domain can be pointed to another domain name which is returned to the resolver</li>
<li>A Record - a domain is mapped to an IP which is returned to the resolver</li>
</ul>
</li>
<li><p>If a domain name is returned we restart the process with the new domain provided to the resolver. If an IP address is returned it is provided to the resolver from the authoritative nameserver.</p>
</li>
<li><p>The DNS resolver responds to the browser with the IP address of the domain requested.</p>
</li>
<li><p>The browser makes a HTTP request to the IP address.</p>
</li>
<li><p>The server at that IP returns the webpage to be displayed in the browser.</p>
</li>
</ol>
<h2 id="common-dns-record-types">Common DNS Record Types</h2>
<ul>
<li><strong>A</strong>: Map a domain name to IPv4 addresses</li>
<li><strong>AAAA</strong>: Map a domain name to IPv6 addresses</li>
<li><strong>CNAME</strong>:  Canonical Name (CNAME) Record is used in the Domain Name System (DNS) to map one domain name to another domain name.</li>
<li><strong>PTR</strong>: Resolve IPv4 or IPv6 addresses to domain names</li>
<li><strong>NS</strong>: Provides a list of the authoritative name servers responsible for the domain</li>
<li><strong>MX</strong>: Provides the domain names of mail servers that receive emails on behalf of a domain</li>
<li><strong>SOA</strong>: Provides details about a DNS zone; required for every DNS zone</li>
<li><strong>TXT</strong>: Provides arbitrary information to be shared in text format</li>
</ul>
]]></content:encoded></item><item><title><![CDATA[Hello World]]></title><description><![CDATA[This is my first post to get things going on my blogging journey.]]></description><link>https://blog.joelcolaco.com/hello-world</link><guid isPermaLink="true">https://blog.joelcolaco.com/hello-world</guid><dc:creator><![CDATA[Joel Colaco]]></dc:creator><pubDate>Fri, 13 Aug 2021 21:02:47 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1628983252549/R-N2-nQFDB.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>This is my first post to get things going on my blogging journey.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1628967896895/qHF_gZSQb.gif" alt="animation_640_ksc5ewjh.gif" /></p>
]]></content:encoded></item></channel></rss>