<?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" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Uddeshya on Medium]]></title>
        <description><![CDATA[Stories by Uddeshya on Medium]]></description>
        <link>https://medium.com/@uddeshyawrites?source=rss-ffb1329990c------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*_chhM7JuFy3ntmdyKKWeZw.png</url>
            <title>Stories by Uddeshya on Medium</title>
            <link>https://medium.com/@uddeshyawrites?source=rss-ffb1329990c------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Wed, 02 Dec 2026 05:51:21 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@uddeshyawrites/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Solving the Workflow, Not Just the AI]]></title>
            <link>https://medium.com/@uddeshyawrites/solving-the-workflow-not-just-the-ai-415edd3500ab?source=rss-ffb1329990c------2</link>
            <guid isPermaLink="false">https://medium.com/p/415edd3500ab</guid>
            <category><![CDATA[design-systems]]></category>
            <category><![CDATA[artificial-intelligence]]></category>
            <category><![CDATA[llm]]></category>
            <category><![CDATA[engineering]]></category>
            <category><![CDATA[software-engineering]]></category>
            <dc:creator><![CDATA[Uddeshya]]></dc:creator>
            <pubDate>Sun, 19 Jul 2026 07:11:00 GMT</pubDate>
            <atom:updated>2026-07-19T07:45:12.016Z</atom:updated>
            <content:encoded><![CDATA[<h4>Lessons from building an AI-assisted localisation pipeline during a five-day hackathon</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*ADzk0XcJb-Pr4Kpd" /><figcaption>Photo by <a href="https://unsplash.com/@jjying?utm_source=medium&amp;utm_medium=referral">JJ Ying</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>Like many developers experimenting with Large Language Models (LLMs), I walked into our internal hackathon with a fairly simple assumption.</p><p>The hardest part of building an AI application would be getting the model to do its job well.</p><p>In our case, that meant translation.</p><p>If we could produce accurate, consistent translations, I assumed we’d have solved the problem.</p><p>Five days later, I realised I’d been solving the wrong problem.</p><p>By the end of the hackathon, I’d learnt that the challenge wasn’t translation, prompt engineering or even choosing the right model. The real challenge was understanding an existing business workflow well enough to redesign it around AI without disrupting the people who depended on it.</p><p>Although this project focused on localisation, the lessons extended far beyond translation. They fundamentally changed the way I think about designing AI-assisted systems.</p><h3>Understanding the Problem</h3><p>Earlier this year, alongside my front-end development responsibilities, I also became the Translation Coordinator for my project. That gave me a completely different perspective on how our software moved from development to production.</p><p>Every release followed a familiar localisation process. New UI strings were exported from our localisation platform, sent to an external translation agency, quoted, approved, translated, imported back into the platform, and finally reviewed before they were published.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xZtzd3cPNGuWLU5SENdJMw.png" /></figure><p>Nothing about the workflow was fundamentally broken. It had evolved, and everyone involved understood their role.</p><p>What stood out to me, however, was the amount of operational work surrounding translation itself. Exporting files, coordinating with translators, tracking progress, importing results and preparing everything for review consumed far more effort than I had expected.</p><p>When our team began discussing hackathon ideas, my instinct was to focus on the most obvious part of the process:</p><p><em>Can we build a better translator?</em></p><p>Looking back, I think that was the wrong question.</p><h3>Reframing the Problem</h3><p>One of the most valuable lessons from the project came surprisingly early.</p><p>We realised we were trying to optimise the wrong part of the workflow.</p><p>Our initial question was centred around technology:</p><blockquote><strong><em>How can AI translate our strings?</em></strong></blockquote><p>As we analysed the localisation process in more detail, it became obvious that translation itself wasn’t the bottleneck. Professional translators already existed, and they were exceptionally good at what they did.</p><p>The larger challenge was everything surrounding the translation.</p><p><em>Preparing files.<br>Managing requests.<br>Waiting for approvals.<br>Importing completed translations.<br>Coordinating the entire workflow.</em></p><p>That shifted our thinking completely.</p><p>Instead of asking how AI could translate our content, we started asking:</p><blockquote><strong><em>How can AI reduce the operational overhead while preserving quality?</em></strong></blockquote><p>It sounds like a small change in perspective.</p><p>In reality, it changed the entire solution.</p><h3>Designing Around the Workflow</h3><p>Once we reframed the problem, our design decisions became much clearer.</p><p>Our objective was never to replace professional translators or eliminate human review. Those parts of the process already worked well and existed for good reasons.</p><p>Instead, we wanted to remove the repetitive tasks that surrounded them.</p><p><em>Could we automatically identify new strings that required translation?</em></p><p><em>Could we provide the model with enough context to generate useful draft translations?</em></p><p><em>Could we preserve consistent terminology?</em></p><p><em>Could we reuse previous translations instead of generating them again?</em></p><p><em>Could we return everything to the existing localisation platform so reviewers could continue working exactly as they always had?</em></p><p>Those questions gradually transformed our project from “an AI translator” into “an AI-assisted localisation pipeline”.</p><p>The distinction mattered because it shifted our attention away from the model and towards the overall system.</p><h3>The Model Was Only One Component</h3><p>Before the hackathon, I expected prompt engineering to occupy most of our time.</p><p>It didn’t.</p><p>Instead, most of our effort went into solving engineering problems around the model.</p><p>We built mechanisms to provide better context, maintain consistent terminology, reuse previous translations, reduce unnecessary token usage and integrate the generated translations back into the existing workflow.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1QhXzva8l1ojFH1wtw6Mdw.png" /></figure><p>Looking back, it’s interesting how small the LLM became within the overall architecture.</p><p>The model generated translations, but the surrounding system determined whether those translations were useful.</p><p>That was one of the biggest surprises of the entire project.</p><h3>What Changed for Me</h3><p>Before this project, I associated AI engineering primarily with prompts, models and APIs.</p><p>Today, I think those are only one part of the picture.</p><p>The more interesting engineering questions looked like this:</p><ul><li>What information does the model actually need?</li><li>How much context is enough?</li><li>How do we maintain consistency across multiple releases?</li><li>How do we reduce unnecessary token consumption?</li><li>How do we integrate AI into an existing workflow without forcing people to change how they work?</li></ul><p>Very few of those questions are about the model itself.</p><p>They’re systems design questions.</p><p>That shift in perspective has stayed with me long after the hackathon ended.</p><h3>Looking Ahead</h3><p>This project introduced us to several engineering challenges that deserve much deeper discussion than one article can provide.</p><p>In future articles, I’ll be exploring topics such as:</p><ul><li>Why context engineering mattered more than prompt engineering.</li><li>Designing an effective translation memory.</li><li>Dynamic glossary retrieval for domain-specific terminology.</li><li>Reducing token consumption without sacrificing quality.</li><li>Building AI systems around existing human workflows.</li></ul><p>Each of those decisions solved a different engineering problem, and together they shaped the final system far more than the prompt ever did.</p><h3>Final Thoughts</h3><p>When I look back at this project, I don’t think we built an AI translator.</p><p>We didn’t build an AI translator. We built a localisation system that happened to use an LLM.</p><p>That distinction fundamentally changed how I think about AI engineering.</p><p>It’s easy to focus on models, prompts and benchmarks because they’re the most visible parts of an AI application. But in practice, the success of a system often depends on everything around the model: understanding the business process, respecting existing workflows, providing the right context and designing for the people who will ultimately use it.</p><p>The technology will continue to evolve.</p><p>Understanding the problem you’re trying to solve will always matter more.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=415edd3500ab" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The Many Languages of Kindness]]></title>
            <link>https://medium.com/@uddeshyawrites/the-many-languages-of-kindness-350a511a7b35?source=rss-ffb1329990c------2</link>
            <guid isPermaLink="false">https://medium.com/p/350a511a7b35</guid>
            <category><![CDATA[personal-growth]]></category>
            <category><![CDATA[honesty]]></category>
            <category><![CDATA[kindness]]></category>
            <category><![CDATA[emotional-intelligence]]></category>
            <category><![CDATA[relationships]]></category>
            <dc:creator><![CDATA[Uddeshya]]></dc:creator>
            <pubDate>Fri, 15 Aug 2025 09:58:25 GMT</pubDate>
            <atom:updated>2025-08-15T09:58:25.213Z</atom:updated>
            <content:encoded><![CDATA[<h4><em>A meditation on intention, perception, honesty, and respect</em></h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*YXXOAekMYZyYCEbb" /><figcaption>Photo by <a href="https://unsplash.com/@breakyourboundaries4?utm_source=medium&amp;utm_medium=referral">Matt Collamer</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><h3>Kindness</h3><p>We speak of it as if it’s a single word, a single act, a single feeling.<br>But the more I look for it, the more I see it shapeshift — changing colour, texture, and tone depending on who’s giving it, who’s receiving it, and what moment they share between them.</p><p>To one person, kindness is a warm arm around the shoulder.<br>To another, it’s space — the gift of being left alone without question.<br>For some, it’s hearing “You can do this.”<br>For others, it’s hearing “You don’t have to.”</p><h3>Intention lives in the heart. Perception lives in the skin.</h3><p>We judge ourselves by our intentions — <em>I meant well</em>.<br>We judge others by how they make us feel — <em>that hurt</em>.</p><p>Both are real.<br>Both matter.</p><p>You might speak your truth to save someone from a bad decision, believing you’ve handed them a map.<br>They might hear it as a wall, closing off the road they hoped to take.</p><p>This is the gap where kindness lives or dies — between what we mean and what is felt.</p><h3>Honesty is a risk. Respect makes it safe.</h3><p>We often think kindness means keeping the peace, smoothing the edges, giving people what they want to hear. But if we’re honest, that’s often about protecting ourselves from discomfort.</p><p>True kindness is not always easy on the ears.<br>It is rooted in respect — respect for time, for energy, for someone’s right to clarity.</p><p>Saying “no” is kind when you mean it, when it spares the other person from waiting on a “maybe” that will never turn into a “yes”.<br>Telling the truth is kind when it comes from care, not superiority.</p><p>Honesty without respect is <em>cruelty</em>.<br>Respect without honesty is <em>theatre</em>.<br>Kindness needs <em>both</em>.</p><h3>When our dialects collide</h3><p>I remember once hesitating before agreeing to a friend’s spontaneous plan.</p><p>The sky looked ready to change its mind. They had been through weeks of last-minute cancellations, and I didn’t want to hand them another one.</p><p>I thought I was being protective.<br>They thought I was being dismissive.</p><p>We were both speaking kindness — just in different dialects. Mine was caution. Theirs was enthusiasm.</p><p>In that moment, I learned something: your kindness doesn’t live in your intention alone. It also lives in your willingness to learn someone else’s language.</p><p>Kindness is also a quiet, everyday practice — not just the big moments of miscommunication.</p><h3>The small kindnesses that age well</h3><p>Some kindnesses sparkle in the moment — the ones that make you laugh, ease your burden, warm you instantly.</p><p>Others are quieter. They don’t feel like much at first.<br>A private correction instead of a public one.<br>Someone remembering you don’t drink chai and not asking again.<br>A friend warning, “You’re burning out,” when everyone else is cheering you on.</p><p>They may not give you butterflies, but they give you roots.</p><h3>The art of carrying both truths</h3><p>If you hold only to your intention, you may leave a trail of misunderstandings behind you.<br>If you hold only to their perception, you may lose yourself in the work of pleasing everyone.</p><p>Kindness asks us to carry both — to speak with honesty and respect, and to stay curious about how it lands.</p><p>Sometimes the bridge between what we mean and what they feel is short.<br>Sometimes it’s a long walk.<br>But the walk is worth it.</p><p>Because kindness, in all its many languages, is less about making everyone happy and more about saying:</p><p><em>I see you. I hear you. I care enough to meet you halfway.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=350a511a7b35" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Importing SVGs in React Shouldn’t Be This Hard]]></title>
            <link>https://javascript.plainenglish.io/svg-in-webpack-5-4845eda3f36c?source=rss-ffb1329990c------2</link>
            <guid isPermaLink="false">https://medium.com/p/4845eda3f36c</guid>
            <category><![CDATA[typescript]]></category>
            <category><![CDATA[react]]></category>
            <category><![CDATA[webpack]]></category>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[svg]]></category>
            <dc:creator><![CDATA[Uddeshya]]></dc:creator>
            <pubDate>Mon, 31 Mar 2025 00:16:13 GMT</pubDate>
            <atom:updated>2025-03-31T00:16:13.259Z</atom:updated>
            <content:encoded><![CDATA[<h4>Ditch file-loader! Learn how to handle SVGs in React with Webpack 5, SVGR, and Jest the right way.</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*2mxvXG6ZXFgbPMt5" /><figcaption>Photo by <a href="https://unsplash.com/@nosoycesar?utm_source=medium&amp;utm_medium=referral">César Abner Martínez Aguilar</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>If you’ve ever worked on a Webpack 4 project, chances are you’ve dealt with file-loader for handling images and babel-plugin-named-asset-import for SVGs. It wasn’t perfect, but it got the job done—until Webpack 5 changed everything.</p><p>Webpack 5 introduced <strong>Asset Modules</strong>, a built-in way to handle static assets without relying on external loaders. This means <strong>no more </strong><strong>file-loader</strong>, <strong>no more Babel hacks</strong>, and <strong>a cleaner way to handle SVGs</strong>. But migrating isn’t just about deleting a dependency—it requires a shift in how you think about asset management.</p><p>So, let’s break it down: why did we use file-loader in the first place, what’s wrong with it now, and how can we leap to Webpack 5’s new approach?</p><h3>How We Handled SVGs in Webpack 4</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*EbfbhH5PJmI5EVWX" /><figcaption>Photo by <a href="https://unsplash.com/@lgnwvr?utm_source=medium&amp;utm_medium=referral">LOGAN WEAVER | @LGNWVR</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>In the Webpack 4 era, handling SVGs usually involved:</p><ul><li>file-loader to generate file URLs.</li><li>babel-plugin-named-asset-import to enable React components for SVGs.</li><li>Custom Jest configurations to avoid breaking tests.</li></ul><p>It looked something like this:</p><h4>Webpack 4 Configuration</h4><pre>module.exports = {<br>  module: {<br>    rules: [<br>      {<br>        test: /\.svg$/,<br>        use: [<br>          {<br>            loader: &#39;file-loader&#39;,<br>            options: {<br>              name: &#39;[name].[hash].[ext]&#39;<br>            }<br>          }<br>        ]<br>      }<br>    ]<br>  }<br>};</pre><h4>Babel Configuration</h4><pre>[<br>  &#39;babel-plugin-named-asset-import&#39;,<br>  {<br>    loaderMap: {<br>      svg: {<br>        ReactComponent: &#39;@svgr/webpack?-svgo,+titleProp,+ref![path]&#39;<br>      }<br>    }<br>  }<br>]</pre><p>This setup allowed you to import SVGs in two ways:</p><ol><li>import icon from &#39;./icon.svg&#39;; → Returns a <strong>file URL</strong>.</li><li>import { ReactComponent as Icon } from &#39;./icon.svg&#39;; → Returns a <strong>React component</strong>.</li></ol><p><strong>It worked, but it wasn’t pretty.</strong> Every new developer had to understand why we needed Babel to process SVGs, and Jest tests needed extra tweaks to handle imports correctly.</p><h3>The Webpack 5 Way: Built-In Asset Modules + SVGR</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*AtSX8MquK9-VdF75" /><figcaption>Photo by <a href="https://unsplash.com/@jeshoots?utm_source=medium&amp;utm_medium=referral">JESHOOTS.COM</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>Webpack 5 changed the game by introducing <strong>Asset Modules</strong>, which make handling static assets like images and fonts much easier. With this approach, we can now:</p><p>✅ Remove file-loader completely <br>✅ Use Webpack’s native asset/resource handling <br>✅ Leverage SVGR without Babel plugins</p><h4>Webpack 5 Configuration</h4><pre>module.exports = {<br>  module: {<br>    rules: [<br>      {<br>        test: /\.svg$/,<br>        oneOf: [<br>          {<br>            resourceQuery: /url/, // Handles `import icon from &#39;./icon.svg?url&#39;`<br>            type: &#39;asset/resource&#39;,<br>          },<br>          {<br>            issuer: /\.[jt]sx?$/, // Ensures SVGR applies only in JS/TS files<br>            use: [&#39;@svgr/webpack&#39;],<br>          },<br>        ],<br>      },<br>    ],<br>  },<br>};</pre><h4>What This Achieves</h4><ul><li>import iconUrl from &#39;./icon.svg?url&#39;; → Returns a <strong>file URL</strong>.</li><li>import Icon from &#39;./icon.svg&#39;; → Returns a <strong>React component</strong>.</li><li><strong>No Babel plugins needed.</strong></li></ul><p>With just a few lines of configuration, <strong>we get the best of both worlds — URL imports and React components — without the hassle.</strong></p><h3>Configuring TypeScript for SVGs</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*0wDqvZKNqErbDk4W" /><figcaption>Photo by <a href="https://unsplash.com/@thetonik_co?utm_source=medium&amp;utm_medium=referral">Tonik</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>If your project uses TypeScript, you need to define how .svg and .svg?url imports should be interpreted. Without these type definitions, TypeScript won’t know what to do with them, leading to errors.</p><h4>Adding Type Definitions</h4><p>To fix this, create or update a global.d.ts (or any .d.ts file in your project) and add the following:</p><pre>/* <br>  Teach TypeScript that importing an SVG like this:  <br>  import SVG from &#39;./assets/file.svg&#39;<br>  Should return a React component.<br>*/<br>declare module &quot;*.svg&quot; {<br>  import React = require(&quot;react&quot;);<br>  const Component: React.FC&lt;React.SVGProps&lt;SVGSVGElement&gt; &amp; { title?: string }&gt;;<br>  export default Component;<br>}<br><br>/* <br>  Teach TypeScript that importing an SVG with ?url, like this:<br>  import SVG from &#39;./assets/file.svg?url&#39;<br>  Should return a string.<br>*/<br>declare module &quot;*.svg?url&quot; {<br>  const content: string;<br>  export default content;<br>}</pre><p>Now, TypeScript knows exactly what to do with your SVG imports, so you can focus on the next step without any surprises.</p><h3>Handling Jest Tests Post-Migration</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*D9f0qDp9TThNDHVQ" /><figcaption>Photo by <a href="https://unsplash.com/@louishansel?utm_source=medium&amp;utm_medium=referral">Louis Hansel</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>With file-loader gone, Jest needs some adjustments to handle .svg imports correctly. Without these changes, tests might fail when trying to process SVG files.</p><h4>The Issue</h4><p>Webpack used to take care of these imports, but now Jest needs to distinguish between <strong>standard </strong><strong>.svg imports</strong>, which should be treated as React components and <strong>.svg?url imports</strong>, which should return a file name instead of causing Jest errors.</p><h4>Updating Jest Configuration</h4><p>To ensure Jest processes these correctly, update the Jest configuration, typically found in jest.config.js or inside the package.json under the jest key:</p><pre>moduleNameMapper: {<br>  &#39;^(.+\\.svg)\\?url$&#39;: &#39;&lt;rootDir&gt;/config/jest/svgUrlMock.js&#39;, // Mocks ?url imports<br>},<br>transform: {<br>  &#39;^.+\\.svg$&#39;: &#39;&lt;rootDir&gt;/config/jest/svgTransform.js&#39;, // Converts SVGs into React components<br>}</pre><h4>Why This Matters</h4><ul><li><strong>Handling </strong><strong>.svg imports:</strong> Since SVGs are often used as React components, svgTransform.js ensures they behave that way in tests.</li><li><strong>Preventing errors with </strong><strong>.svg?url imports:</strong> These don’t point to actual files, so Jest would fail to resolve them. Instead, moduleNameMapper returns a mock value.</li></ul><h4>svgUrlMock.js</h4><p>This mock ensures that Jest correctly handles imports with ?url by returning a placeholder string instead of trying to process the actual file.</p><pre>module.exports = &quot;mock-svg-url&quot;;</pre><h4>svgTransform.js</h4><p>This Jest transform converts SVGs into React components, ensuring that tests don’t break when encountering SVG imports.</p><pre>const path = require(&quot;path&quot;);<br>const camelcase = require(&quot;camelcase&quot;);<br><br>module.exports = {<br>  process(src, filePath) {<br>    if (path.extreme(filePath) !== &quot;.svg&quot;) {<br>      return src;<br>    }<br>    const assetFilename = JSON.stringify(path.basename(filePath));<br>    const pascalCaseFilename = camelcase(path.parse(filePath).name, {<br>      pascalCase: true<br>    });<br>    const name = `Svg${pascalCaseFilename}`;<br>    return `<br>      const React = require(&#39;react&#39;);<br>      function ${name}(props) {<br>        return React.createElement(<br>          &#39;svg&#39;,<br>          Object.assign({}, props, {<br>            children: ${assetFilename}<br>          }),<br>        );<br>      }<br>      module.exports = ${name};<br>    `;<br>  }<br>};</pre><p>With these updates, tests continue running smoothly without breaking due to Webpack changes.</p><h3>Final Thoughts</h3><p>Migrating from file-loader to <strong>Webpack 5 Asset Modules + SVGR</strong> is a significant upgrade. It simplifies your setup, removes unnecessary dependencies, and improves maintainability. If you’re still clinging to file-loader, now’s the perfect time to make the switch.</p><p>With Webpack 5, we let <strong>native tools do the heavy lifting</strong>, reducing complexity and ensuring future compatibility. The migration process may take some effort, but the benefits are well worth it.</p><h3>Resources</h3><ol><li>What is an SVG? (<a href="https://developer.mozilla.org/en-US/docs/Web/SVG">Link</a>)</li><li>Webpack 5 Asset Modules (<a href="https://webpack.js.org/guides/asset-modules/">Link</a>)</li><li>SVGR Webpack loader (<a href="https://react-svgr.com/docs/webpack/">Link</a>)</li><li>SVGs and TypeScript (<a href="https://webpack.js.org/guides/typescript/#importing-other-assets">Link</a>)</li><li>Configuring Jest (<a href="https://jestjs.io/docs/configuration">Link</a>)</li></ol><h3>Thank you for being a part of the community</h3><p><em>Before you go:</em></p><ul><li>Be sure to <strong>clap</strong> and <strong>follow</strong> the writer ️👏<strong>️️</strong></li><li>Follow us: <a href="https://x.com/inPlainEngHQ"><strong>X</strong></a> | <a href="https://www.linkedin.com/company/inplainenglish/"><strong>LinkedIn</strong></a> | <a href="https://www.youtube.com/@InPlainEnglish"><strong>YouTube</strong></a> | <a href="https://newsletter.plainenglish.io/"><strong>Newsletter</strong></a> | <a href="https://open.spotify.com/show/7qxylRWKhvZwMz2WuEoua0"><strong>Podcast</strong></a> | <a href="https://differ.blog/inplainenglish"><strong>Differ</strong></a> | <a href="https://twitch.tv/inplainenglish"><strong>Twitch</strong></a></li><li><a href="https://cofeed.app/"><strong>Check out CoFeed, the smart way to stay up-to-date with the latest in tech</strong></a> <strong>🧪</strong></li><li><a href="https://differ.blog/"><strong>Start your own free AI-powered blog on Differ</strong></a> 🚀</li><li><a href="https://discord.gg/in-plain-english-709094664682340443"><strong>Join our content creators community on Discord</strong></a> 🧑🏻‍💻</li><li>For more content, visit <a href="https://plainenglish.io/"><strong>plainenglish.io</strong></a> + <a href="https://stackademic.com/"><strong>stackademic.com</strong></a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4845eda3f36c" width="1" height="1" alt=""><hr><p><a href="https://javascript.plainenglish.io/svg-in-webpack-5-4845eda3f36c">Importing SVGs in React Shouldn’t Be This Hard</a> was originally published in <a href="https://javascript.plainenglish.io/">JavaScript in Plain English</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to Easily Manage Multiple Git Accounts on Mac]]></title>
            <link>https://medium.com/@uddeshyawrites/how-to-easily-manage-multiple-git-accounts-on-mac-8662c8a8e858?source=rss-ffb1329990c------2</link>
            <guid isPermaLink="false">https://medium.com/p/8662c8a8e858</guid>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[developer-tools]]></category>
            <category><![CDATA[ssh]]></category>
            <category><![CDATA[git]]></category>
            <category><![CDATA[productivity]]></category>
            <dc:creator><![CDATA[Uddeshya]]></dc:creator>
            <pubDate>Wed, 26 Mar 2025 05:53:10 GMT</pubDate>
            <atom:updated>2025-03-26T05:56:49.377Z</atom:updated>
            <content:encoded><![CDATA[<h4>Streamline your Git workflow by automating SSH and user configs.</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*wD9z_WK-x33byOSY" /><figcaption>Photo by <a href="https://unsplash.com/@judy_beth_morris_idaho?utm_source=medium&amp;utm_medium=referral">Judy Beth Morris</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>You’re working away on your tasks, but now you want to dive into some side projects. You open up your terminal, clone your personal repo, and… it doesn’t work. It’s because your system still uses your work Git account for everything.</p><p>It’s like trying to send a personal email from your work account — it just doesn’t fit. But don’t worry, you can fix this. In this guide, you’ll learn how to:</p><ul><li>Set up separate SSH keys for your work and personal accounts.</li><li>Automatically switch between accounts based on your project.</li><li>Ensure Git always uses the right credentials for the right repo.</li></ul><p>Let’s get started!</p><h3>The Problem: Work vs Personal Git Accounts</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*-LO7RoeapMmBkGVv" /><figcaption>Photo by <a href="https://unsplash.com/@lanirudhreddy?utm_source=medium&amp;utm_medium=referral">ANIRUDH</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>Git doesn’t inherently know which account you want to use for a specific project. This leads to common problems such as:</p><ul><li><strong>Wrong Email in Commits</strong> — Work projects might get signed with your personal email and vice versa.</li><li><strong>SSH Conflicts</strong> — Pushing code might fail because GitHub rejects the wrong SSH key.</li><li><strong>Tedious Manual Switching</strong> — Constantly setting credentials manually is frustrating.</li></ul><p>The solution? A well-structured setup that automatically selects the right Git identity for each project.</p><h3>Step 1: Generate and Manage SSH Keys</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*8q55YC3A1Z2mgRM0" /><figcaption>Photo by <a href="https://unsplash.com/@lazycreekimages?utm_source=medium&amp;utm_medium=referral">Michael Dziedzic</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>First, check if you already have SSH keys:</p><pre>ls ~/.ssh/</pre><p>If you see files like id_rsa.pub or id_ed25519.pub, you already have a key. And these keys probably belong to the Git account you have already set up in your system.</p><h4>Creating Separate SSH Keys</h4><p>For your <strong>work account</strong>:</p><pre>ssh-keygen -t ed25519 -C &quot;your_work_email@example.com&quot; -f ~/.ssh/id_ed25519_work</pre><p>For your <strong>personal account</strong>:</p><pre>ssh-keygen -t ed25519 -C &quot;your_personal_email@example.com&quot; -f ~/.ssh/id_ed25519_personal</pre><h4>Adding the SSH Keys to the Agent</h4><pre>ssh-add ~/.ssh/id_ed25519_work<br>ssh-add ~/.ssh/id_ed25519_personal</pre><h4>Adding the Keys to GitHub</h4><p>Copy each public key and add it to the corresponding GitHub account:</p><pre>cat ~/.ssh/id_ed25519_work.pub<br>cat ~/.ssh/id_ed25519_personal.pub</pre><p>Go to <strong>GitHub → Settings → SSH and GPG keys → New SSH key</strong>, then paste the keys accordingly.</p><p>To verify:</p><pre>ssh -T git@github.com</pre><p>If successful, GitHub will greet you with the correct username:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*SgkGW3YP341Sli-61ZVGBA.png" /></figure><h3>Step 2: Automate Account Selection with SSH Config</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*T1fR7EBQMn6dCR4V" /><figcaption>Photo by <a href="https://unsplash.com/@edgr?utm_source=medium&amp;utm_medium=referral">Edu Grande</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>Now, let’s automate the selection of SSH keys by configuring ~/.ssh/config.</p><p>Run this command to edit (or create) the config file.</p><pre>touch ~/.ssh/config<br>nano ~/.ssh/config</pre><p>Add the following:</p><pre># Work Account<br>Host github-work<br>    HostName github.com<br>    User git<br>    IdentityFile ~/.ssh/id_ed25519_work<br><br># Personal Account<br>Host github-personal<br>    HostName github.com<br>    User git<br>    IdentityFile ~/.ssh/id_ed25519_personal</pre><p>Save and exit (<strong>Ctrl + X → Y → Enter</strong>).</p><p>Now, when cloning a work repo, replace github.com with github-work and with github-personal when cloning a personal repo.</p><pre>git clone git@github-work:yourcompany/repo.git<br>git clone git@github-personal:yourusername/repo.git</pre><p>This forces Git to use the correct SSH keys for your personal and work accounts. No need to manually switch SSH keys!</p><h3>Step 3: Ensure the Right Git Identity Per Project</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*_tqgATBMKHQ-6Kus" /><figcaption>Photo by <a href="https://unsplash.com/@brett_jordan?utm_source=medium&amp;utm_medium=referral">Brett Jordan</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>Instead of manually changing emails, let’s make Git smart enough to switch profiles automatically.</p><p>Open your global Git config:</p><pre>nano ~/.gitconfig</pre><p>Add conditional includes based on your project directories:</p><pre>[includeIf &quot;gitdir:/Users/yourname/work-projects/&quot;]<br>    path = ~/.gitconfig-work<br><br>[includeIf &quot;gitdir:/Users/yourname/personal-projects/&quot;]<br>    path = ~/.gitconfig-personal</pre><p>Now, create ~/.gitconfig-work for your work profile:</p><pre>[user]<br>    email = your_work_email@example.com<br>    name = Your Name</pre><p>And ~/.gitconfig-personal for your personal projects:</p><pre>[user]<br>    email = your_personal_email@example.com<br>    name = Your Name</pre><h4>Verifying It Works</h4><p>Navigate to a personal project and check the email:</p><pre>cd /Users/yourname/personal-projects/matrix-2.0<br>git config --get user.email</pre><p>Then do the same for a work project. Git should automatically apply the correct email.</p><h3>Step 4: Testing &amp; Troubleshooting</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*2toseyruwt1hLdRW" /><figcaption>Photo by <a href="https://unsplash.com/@victoriakubiaki?utm_source=medium&amp;utm_medium=referral">Victória Kubiaki</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>Run these checks to ensure everything is working correctly:</p><h4><strong>1. Check Which SSH Key is Being Used</strong></h4><pre>ssh -T git@github.com</pre><p>If it logs into the wrong account, ensure ~/.ssh/config is correctly set.</p><h4><strong>2. Verify Git Identity in a Repo</strong></h4><pre>git config --get user.email</pre><p>Make sure this matches the expected email for that project.</p><h4><strong>3. Fix “Permission Denied (publickey)” Errors</strong></h4><p>If GitHub rejects your SSH key, restart the SSH agent:</p><pre>eval &quot;$(ssh-agent -s)&quot;<br>ssh-add ~/.ssh/id_ed25519_work  # Or your personal key</pre><h3>Wrapping Up</h3><p>Juggling work and personal Git accounts doesn’t have to be a nightmare. With the right setup, Git will always know <em>who</em> you are and <em>where</em> you’re working — no more accidental commits with the wrong email or SSH errors ruining your flow.</p><p>Now you can focus on what actually matters: coding your next big thing (or fixing that one stubborn bug). Set it up once, and let Git handle the rest.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8662c8a8e858" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Welcome to the Third Party!]]></title>
            <link>https://javascript.plainenglish.io/welcome-to-the-third-party-6bac315ba531?source=rss-ffb1329990c------2</link>
            <guid isPermaLink="false">https://medium.com/p/6bac315ba531</guid>
            <category><![CDATA[coding]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[react]]></category>
            <category><![CDATA[programming]]></category>
            <dc:creator><![CDATA[Uddeshya]]></dc:creator>
            <pubDate>Wed, 08 Nov 2023 12:16:59 GMT</pubDate>
            <atom:updated>2023-11-08T12:16:59.953Z</atom:updated>
            <content:encoded><![CDATA[<h4>Libraries for Code Splitting in React</h4><figure><img alt="A DJ at a party." src="https://cdn-images-1.medium.com/max/1024/0*U0eTYqg18dZXPovW" /><figcaption>Photo by <a href="https://unsplash.com/@omgitsmattyvee?utm_source=medium&amp;utm_medium=referral">Matty Adame</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>In the previous article <a href="https://medium.com/javascript-in-plain-english/code-splitting-the-what-why-and-how-3d18acb6c18c"><strong>Code Splitting — The What, Why and How</strong></a>, we embarked on a journey through the fascinating world of code splitting in React. We discovered its significance, delved into dynamic imports, lazy loading, and harnessed the capabilities of Webpack. As the story continues, we find ourselves in a new chapter, ready to explore a realm of third-party libraries that will elevate our React applications to new heights.</p><h3>Revisiting Code Splitting</h3><p>Let’s start where we left off. Code splitting is the magic wand that transforms sluggish load times into lightning-fast user experiences. React applications, while powerful, can suffer from large initial bundle sizes that hinder performance. The solution? Dividing your code into smaller, more manageable pieces, loading them on-demand. In the previous article, we covered the fundamentals, but now, we’re ready to explore the advanced techniques offered by third-party libraries.</p><h3>The Third-Party Arsenal</h3><p>React’s built-in code-splitting capabilities are useful, but third-party libraries provide additional features, flexibility, and optimisations. Here are some top third-party libraries that can take your React app’s performance to the next level:</p><h3>React Loadable</h3><figure><img alt="A bike with a ridiculously large load of hay." src="https://cdn-images-1.medium.com/max/1024/0*gj7vf02qtlo7L4fi" /><figcaption>Photo by <a href="https://unsplash.com/@raymondo600?utm_source=medium&amp;utm_medium=referral">Ray Harrington</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>React Loadable is a trusted companion for those looking to implement code splitting in React applications. With its simple and efficient approach, it’s a popular choice to reduce initial load times.</p><h4><strong>Installation</strong></h4><p>To get started with React Loadable, simply install the library using npm:</p><pre>npm install react-loadable</pre><p>or yarn:</p><pre>yarn add react-loadable</pre><h4><strong>Usage</strong></h4><p>React Loadable offers a simple and straightforward API for loading components dynamically. Creating a loadable component is as easy as using the Loadable function.</p><p>Define a <strong>loader</strong> for your component and specify a <strong>loading</strong> component to display while the main component loads:</p><pre>import Loadable from &#39;react-loadable&#39;;<br><br>const MyComponent = Loadable({<br>  loader: () =&gt; import(&#39;./MyComponent&#39;),<br>  loading: () =&gt; &lt;div&gt;Loading...&lt;/div&gt;,<br>});</pre><p>With this in place, you can seamlessly incorporate MyComponent into your application, treating it just like any other React component.</p><h4><strong>Dynamic Imports</strong></h4><p>React Loadable harnesses the power of dynamic imports, ensuring that components load only when they’re needed. This translates to a smaller initial bundle size and a more responsive user experience.</p><h4>Keep in Mind</h4><p>React Loadable is a fantastic choice to kickstart your code-splitting journey. However, it’s important to note that React itself has introduced built-in features for code splitting and lazy loading, such as React.lazy() and Suspense. Depending on your project&#39;s requirements and your familiarity with these libraries, you might consider using the built-in features.</p><h3>Loadable Components</h3><figure><img alt="A big stack of old retro game cartridges." src="https://cdn-images-1.medium.com/max/1024/1*sOwWPhrEby-uu2jz4UTGTg.jpeg" /><figcaption>Photo by <a href="https://www.pexels.com/@technobulka/">Stanislav Kondratiev</a> on <a href="https://www.pexels.com/photo/boxes-with-retro-video-games-5883536/">Pexels</a></figcaption></figure><p>Let’s turn our attention to another powerful tool in the code-splitting toolkit — Loadable Components. Much like React Loadable, Loadable Components offers an efficient way to enhance your application’s performance by dynamically loading components as needed. It’s all about reducing load times and ensuring a smoother user experience.</p><h4>Installation</h4><p>You can easily integrate Loadable Components into your project using npm:</p><pre>npm install @loadable/component</pre><p>or yarn:</p><pre>yarn add @loadable/component</pre><h4>Usage</h4><p>Loadable Components make the process of dynamically loading components a breeze. Using the loadable function, define a Loadable Component by specifying a loader function for your component. The loader function is a <strong>dynamic import</strong> that fetches the component when it&#39;s needed.</p><pre>import loadable from &#39;@loadable/component&#39;;<br><br>const MyComponent = loadable(() =&gt; import(&#39;./MyComponent&#39;));</pre><p>Once you’ve defined your Loadable Component, you can use it just like any other React component in your application.</p><h4>Seamless Integration with React Suspense</h4><p>One of the standout features of Loadable Components is its seamless integration with <strong>React Suspense</strong>, a valuable feature that simplifies managing loading states and displaying fallback UI while components are loading. This makes it easier to work with asynchronous rendering and data fetching in your application.</p><pre>import { Suspense } from &#39;react&#39;;<br>import loadable from &#39;@loadable/component&#39;;<br><br>const MyComponent = loadable(() =&gt; import(&#39;./MyComponent&#39;), {<br>  fallback: &lt;div&gt;Loading...&lt;/div&gt;,<br>});<br><br>function App() {<br>  return (<br>    &lt;div&gt;<br>      &lt;h1&gt;My Awesome App&lt;/h1&gt;<br>      &lt;Suspense fallback={&lt;div&gt;Loading...&lt;/div&gt;}&gt;<br>        &lt;MyComponent /&gt;<br>      &lt;/Suspense&gt;<br>    &lt;/div&gt;<br>  );<br>}</pre><p>In this example, we’ve wrapped our Loadable Component with Suspense to handle loading states gracefully.</p><h4>Why Two Fallbacks?</h4><p>Having a fallback in both Loadable Components and React Suspense serves to ensure a seamless user experience while addressing distinct aspects of the loading process:</p><ul><li><strong>Loadable Components Fallback</strong>: Loadable Components’ fallback property customises loading indicators for specific components, tailoring the loading UI to each component’s context. For example, an image gallery component can have a unique loading spinner matching its visual style.</li><li><strong>React Suspense Fallback</strong>: In contrast, React Suspense manages loading states at a broader level, not tied to individual components. It provides a consistent loading experience across the entire application, making it ideal for scenarios where multiple components or data sources load concurrently.</li></ul><p>Depending on your use case, you can employ one or both of these methods to craft a comprehensive loading experience in your application.</p><h4>Keep in Mind</h4><p>While Loadable Components are a powerful choice, consider the level of community support and updates you may require for your project. Ensure that the library’s development aligns with your project’s needs.</p><h3>Conclusion</h3><p>Throughout this article, we’ve explored the significance of code splitting, the role of third-party libraries like React Loadable and Loadable Components, and how these libraries streamline the loading of dynamically loaded components. These tools empower developers to reduce bundle sizes, create smooth loading experiences, and optimise projects.</p><p>As you embark on your React projects, remember the importance of choosing the right code splitting library, creating loading indicators and error handling, and considering the integration with React Suspense.</p><p>If you’re eager for more insights or if you missed my foundational article on code splitting in React, you can catch up here: <a href="https://medium.com/javascript-in-plain-english/code-splitting-the-what-why-and-how-3d18acb6c18c">Code Splitting — The What, Why and How</a>.</p><p>Together, we’ll continue to improve the web development landscape, one dynamically loaded component at a time.</p><h3>Resources</h3><ol><li>“React Loadable Documentation” — Official documentation for React Loadable. <a href="https://github.com/jamiebuilds/react-loadable">Link</a></li><li>“Loadable Components Documentation” — In-depth documentation for Loadable Components, including usage guidelines and advanced features. <a href="https://loadable-components.com/docs/getting-started/">Link</a></li><li>“React Suspense Documentation” — Learn more about React Suspense, a powerful tool for managing asynchronous loading states in your application. <a href="https://react.dev/reference/react/Suspense">Link</a></li></ol><h3>In Plain English</h3><p><em>Thank you for being a part of our community! Before you go:</em></p><ul><li><em>Be sure to </em><strong><em>clap</em></strong><em> and </em><strong><em>follow</em></strong><em> the writer! 👏</em></li><li><em>You can find even more content at </em><a href="https://plainenglish.io/"><strong><em>PlainEnglish.io</em></strong></a><strong><em> 🚀</em></strong></li><li><em>Sign up for our </em><a href="http://newsletter.plainenglish.io/"><strong><em>free weekly newsletter</em></strong></a><em>. 🗞️</em></li><li><em>Follow us: </em><a href="https://twitter.com/inPlainEngHQ"><strong><em>Twitter</em></strong></a><strong><em>(X</em></strong>), <a href="https://www.linkedin.com/company/inplainenglish/"><strong><em>LinkedIn</em></strong></a>, <a href="https://www.youtube.com/channel/UCtipWUghju290NWcn8jhyAw"><strong><em>YouTube</em></strong></a>, <a href="https://discord.gg/in-plain-english-709094664682340443"><strong><em>Discord</em></strong></a><strong><em>.</em></strong></li><li><em>Check out our other platforms: </em><a href="https://stackademic.com/"><strong><em>Stackademic</em></strong></a>, <a href="https://cofeed.app/"><strong><em>CoFeed</em></strong></a>, <a href="https://venturemagazine.net/"><strong><em>Venture</em></strong></a>.</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6bac315ba531" width="1" height="1" alt=""><hr><p><a href="https://javascript.plainenglish.io/welcome-to-the-third-party-6bac315ba531">Welcome to the Third Party!</a> was originally published in <a href="https://javascript.plainenglish.io/">JavaScript in Plain English</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Code Splitting — The What, Why and How]]></title>
            <link>https://javascript.plainenglish.io/code-splitting-the-what-why-and-how-3d18acb6c18c?source=rss-ffb1329990c------2</link>
            <guid isPermaLink="false">https://medium.com/p/3d18acb6c18c</guid>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[react]]></category>
            <category><![CDATA[code-optimization]]></category>
            <dc:creator><![CDATA[Uddeshya]]></dc:creator>
            <pubDate>Wed, 25 Oct 2023 10:16:00 GMT</pubDate>
            <atom:updated>2023-11-04T12:13:27.720Z</atom:updated>
            <content:encoded><![CDATA[<h3>Code Splitting — The What, Why and How</h3><h4>The recipe for a faster, smoother React application</h4><figure><img alt="Chopped chilli next to a knife" src="https://cdn-images-1.medium.com/max/1024/0*5au2gXCdJONlbH7d" /><figcaption>Photo by <a href="https://unsplash.com/@webdesignnewcastle?utm_source=medium&amp;utm_medium=referral">Nick Collins</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>Picture this: you’re a master chef in a busy restaurant. Your kitchen has every ingredient and utensil imaginable. But there’s a catch — you’re the only one running the show, and every order has to go through you.<br>As the restaurant gets busier, you’re overwhelmed. You’re trying to cook spaghetti, prepare a salad, and bake a cake, all at the same time. Customers are getting restless; they’re hungry, and the longer they wait, the less they enjoy the experience.</p><p>Now, let’s move this scene to the world of web development, particularly React applications. In this analogy, you’re the browser, the chef’s tasks represent the various parts of your web application, and the hungry customers symbolise your users.</p><p>In the early days of web development, this was a common scenario. Web applications were like that overburdened chef, bundling everything into one massive serving. The result? Slow loading times and your users — they were not delighted.</p><p>This is where “code splitting” comes into the picture. Code splitting is like having a team of chefs in your kitchen. Instead of one person doing everything, tasks are distributed. In the web world, it means breaking down your application into smaller, manageable pieces and serving them up only when needed.</p><h3>What is Code Splitting?</h3><figure><img alt="A cup split in half" src="https://cdn-images-1.medium.com/max/1024/0*huIy6lRtPGIM97Hj" /><figcaption>Photo by <a href="https://unsplash.com/@alphabetania?utm_source=medium&amp;utm_medium=referral">Tania Melnyczuk</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>Normally, all the code for a web app is bundled into one massive file. When someone opens the site, they have to download the entire file, even if they only use a small part of it. This makes the site slower.</p><p>Code splitting divides this big file into smaller modules. Each module contains only the code needed for a specific part of the site. So, when someone visits, only the necessary parts load. If they’re on the homepage, only the homepage code loads. If they move to another section, that section’s code loads as they go.</p><p>To make it work, developers use tools like dynamic imports and async module loading in JavaScript. These tools split the code into separate pieces and load the right ones as users need them. It’s like opening only the chapters you want to read in a book, not the whole thing.</p><h3>Why Do I Need it?</h3><figure><img alt="A big arrow sign made of light bulbs on a wall" src="https://cdn-images-1.medium.com/max/1024/0*clRcRr0YUTfRb6TC" /><figcaption>Photo by <a href="https://unsplash.com/@kalebtapp?utm_source=medium&amp;utm_medium=referral">kaleb tapp</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><ol><li><strong>Faster Loading Times</strong>: Just like customers don’t want to wait too long for their food, web users don’t want to wait for a webpage to load. Code splitting reduces the initial bundle size, making your application load faster.</li><li><strong>Better User Experience</strong>: Imagine if the chef only starts preparing your dish when you order it. That’s what code splitting does for your application. It loads only the necessary parts so users can interact with your app sooner.</li><li><strong>Optimised Performance</strong>: Smaller bundles result in better performance. Your app runs smoother, even on devices with slower connections or less processing power.</li><li><strong>Efficient Use of Resources</strong>: Code splitting ensures that your application doesn’t waste resources by loading everything at once. It’s like only preparing a dish when ordered, avoiding waste.</li></ol><p>In essence, code splitting is the secret sauce that makes your web application a fast-food restaurant, where users get their orders quickly and enjoy a pleasant experience. It’s all about serving up what’s needed, when it’s needed — and that’s why you need it.</p><h3>How Do I It?</h3><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fgiphy.com%2Fembed%2FkItp7SxtBjqMkNJMrU%2Ftwitter%2Fiframe&amp;display_name=Giphy&amp;url=https%3A%2F%2Fmedia.giphy.com%2Fmedia%2FkItp7SxtBjqMkNJMrU%2Fgiphy.gif&amp;image=https%3A%2F%2Fi.giphy.com%2Fmedia%2FkItp7SxtBjqMkNJMrU%2Fgiphy.gif&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=giphy" width="435" height="244" frameborder="0" scrolling="no"><a href="https://medium.com/media/cdf3355e74f72a50581411bdf216942a/href">https://medium.com/media/cdf3355e74f72a50581411bdf216942a/href</a></iframe><p>There are several ways to implement code splitting, depending on your tech stack and build tools. Here are a few common methods:</p><ol><li><strong>Dynamic Imports:</strong> Most modern JavaScript frameworks and libraries, such as React, Vue, and Angular, support dynamic imports. You can use them to load components or modules only when they are needed.</li><li><strong>Lazy Loading:</strong> Lazy loading is a technique where you load code on demand, typically for routes or components. This is commonly used in single-page applications (SPAs).</li><li><strong>Webpack:</strong> Webpack, a popular build tool, has built-in support for code splitting. You can configure it to split your code automatically or manually by defining entry points.</li><li><strong>Server-Side Rendering (SSR):</strong> If you’re using SSR, you can split your server-rendered and client-rendered code to optimise the initial load for your users.</li><li><strong>Third-Party Libraries:</strong> There are third-party libraries and tools like Loadable Components and React Loadable that make code splitting easier, especially for React applications.</li></ol><p>We’ll dive into specific examples and implementation details for some of these methods to help you get started with code splitting. Whether you’re working on a small personal project or a large-scale application, code splitting can make a significant difference in your web performance.</p><h3>Dynamic Imports</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*CCNIRAZbiH2czId2" /><figcaption>optimPhoto by <a href="https://unsplash.com/@william07?utm_source=medium&amp;utm_medium=referral">william william</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>Dynamic imports in React allow you to load modules or components on-demand, reducing the initial load time of your application and improving performance. This is achieved using the import() function, which loads code only when it&#39;s needed.</p><p><strong>Example</strong>:</p><p>Suppose you have a React component named MyComponent that you want to load dynamically:</p><pre>import React, { useState, useEffect, ReactElement } from &#39;react&#39;;<br><br>const App: React.FC = (): ReactElement =&gt; {<br>  const [MyComponent, setMyComponent] = useState&lt;React.FC | null&gt;(null);<br><br>  useEffect(() =&gt; {<br>    // Dynamically import MyComponent when the component mounts<br>    import(&#39;./MyComponent&#39;).then((module) =&gt; {<br>      setMyComponent(() =&gt; module.default);<br>    });<br>  }, []);<br><br>  return (<br>    &lt;div&gt;<br>      &lt;h1&gt;My App&lt;/h1&gt;<br>      {MyComponent ? &lt;MyComponent /&gt; : &lt;p&gt;Loading...&lt;/p&gt;}<br>    &lt;/div&gt;<br>  );<br>}<br><br>export default App;</pre><p>In this example, the MyComponent is loaded dynamically using import(). The useState hook manages the loaded component, and the component is only rendered when it&#39;s available, ensuring a faster initial load time for your application.</p><h4>Enhancing with Higher-Order Components (HOCs)</h4><p>Higher-Order Components, or HOCs, are design patterns in React that can be seamlessly combined with dynamic imports. HOCs are functions that take a component and return a new component with enhanced capabilities.</p><p>For code-splitting purposes, you can create an HOC that takes care of the dynamic import process, enabling the dynamic loading of components or modules.</p><p>Here’s an example of a custom HOC called asyncComponent:</p><pre>import React, { useState, useEffect, ReactElement } from &#39;react&#39;;<br><br>const asyncComponent = (importComponent: () =&gt; Promise&lt;{ default: React.FC }&gt;) =&gt; {<br>  return function LoadedComponent(props: any): ReactElement {<br>    const [Component, setComponent] = useState&lt;React.FC | null&gt;(null);<br><br>    useEffect(() =&gt; {<br>      importComponent().then((module) =&gt; {<br>        setComponent(() =&gt; module.default);<br>      });<br>    }, []);<br><br>    return Component ? &lt;Component {...props} /&gt; : &lt;p&gt;Loading...&lt;/p&gt;;<br>  };<br>};<br><br>// Create a component that will be loaded dynamically using the asyncComponent HOC<br>const MyComponent = asyncComponent(() =&gt; import(&#39;./MyComponent&#39;));</pre><p>In this example, the asyncComponent HOC encapsulates the dynamic import logic. You can then use this HOC to create components that load asynchronously, further enhancing your app’s performance.</p><h3>Lazy Loading</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*lZG-DDe65godH0ZE" /><figcaption>Photo by <a href="https://unsplash.com/@c_b_ozaltun?utm_source=medium&amp;utm_medium=referral">Cenk Batuhan Özaltun</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>Lazy loading is a helpful web development technique that enhances the performance of your website. Instead of loading all resources, like images, scripts, or components, right at the beginning, it patiently waits until you actually need them. It’s like saving dessert for last — you get it only when you’re ready. This not only speeds up your website but also saves data and bandwidth, making the whole experience more efficient.</p><p>In React, you can implement <strong>lazy loading for components </strong>using the React.lazy function.</p><pre>import React, { lazy } from &#39;react&#39;;<br><br>// Lazy load the MyComponent<br>const MyLazyComponent = lazy(() =&gt; import(&#39;./MyComponent&#39;));<br><br>const App: React.FC = () =&gt; {<br>  return (<br>    &lt;div&gt;<br>      &lt;Suspense fallback={&lt;div&gt;Loading...&lt;/div&gt;}&gt;<br>        &lt;MyLazyComponent /&gt;<br>      &lt;/Suspense&gt;<br>    &lt;/div&gt;<br>  );<br>}</pre><p>In this example, the MyLazyComponent is loaded dynamically only when it&#39;s actually needed. The Suspense component provides a fallback UI (in this case, a &quot;Loading...&quot; message) while the component is being loaded. This approach ensures that the MyLazyComponent is fetched on-demand, improving the initial loading speed of your React application.</p><h4><strong>Route-Based Lazy Loading for Enhanced Performance:</strong></h4><p>In addition to lazy loading individual components, React offers a powerful technique known as route-based lazy loading. This technique allows you to load specific components only when particular routes are accessed, further improving the initial loading speed and overall performance of your application.</p><p>By combining React Lazy with a routing library like React Router, you can implement this approach seamlessly.</p><pre>import React, { lazy, Suspense } from &#39;react&#39;;<br>import { BrowserRouter as Router, Route, Switch } from &#39;react-router-dom&#39;;<br><br>const Home = lazy(() =&gt; import(&#39;./components/Home&#39;));<br>const About = lazy(() =&gt; import(&#39;./components/About&#39;));<br><br>const App: React.FC = () =&gt; {<br>  return (<br>    &lt;Router&gt;<br>      &lt;Suspense fallback={&lt;div&gt;Loading...&lt;/div&gt;}&gt;<br>        &lt;Switch&gt;<br>          &lt;Route path=&quot;/&quot; exact component={Home} /&gt;<br>          &lt;Route path=&quot;/about&quot; component={About} /&gt;<br>        &lt;/Switch&gt;<br>      &lt;/Suspense&gt;<br>    &lt;/Router&gt;<br>  );<br>}</pre><p>In this example, we’ve used React Lazy to load the Home and About components lazily when their respective routes are accessed. When users navigate to the specified routes (e.g., / or /about), the corresponding components are loaded on-demand.</p><h3>Code Splitting with Webpack</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*IGIOgQt6ZCu88H1B" /><figcaption>Photo by <a href="https://unsplash.com/@rubavi78?utm_source=medium&amp;utm_medium=referral">Rubén Bagüés</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>Webpack is a popular open-source JavaScript module bundler. It takes modules with dependencies and generates static assets, allowing you to bundle and optimise your JavaScript code, stylesheets, and more.</p><p>Code splitting with Webpack is an alternative approach to managing the size and loading of JavaScript code in web applications. It allows you to automatically and efficiently split your code into smaller bundles, reducing initial load times and optimising performance. This stands in contrast to traditional approaches where the entire codebase is bundled into a single, larger file.</p><p>To achieve code splitting, you make use of <strong>dynamic imports </strong>and Webpack’s “<strong>SplitChunks</strong>” optimisation. Dynamic imports allow you to specify which parts of your application should be loaded only when they are needed, rather than upfront. Meanwhile, the “SplitChunks” feature identifies and extracts common code into separate chunks, reducing duplication and optimising shared dependencies.</p><h4>Here’s how to do it:</h4><p>You need to set up your Webpack configuration to enable code splitting. This is typically done in your webpack.config.js file.</p><pre>// webpack.config.js<br>const path = require(&#39;path&#39;);<br><br>module.exports = {<br>  entry: &#39;./src/index.js&#39;, // Your main entry point<br>  output: {<br>    filename: &#39;bundle.js&#39;, // The name of the main bundle<br>    path: path.resolve(__dirname, &#39;dist&#39;), // Output directory<br>  },<br>  optimization: {<br>    splitChunks: {<br>      chunks: &#39;all&#39;, // Enable code splitting for all types of chunks<br>    },<br>  },<br>};</pre><p>In the configuration above, we specify optimization.splitChunks to indicate that code splitting should be enabled for all chunks.</p><p>To utilize code splitting, you need to use dynamic imports in your JavaScript code. This means you’ll import modules or components only when they are needed, rather than loading them all at once.</p><pre>// Dynamically import a module<br>import(&#39;./DynamicComponent&#39;).then((dynamicModule) =&gt; {<br>  dynamicModule.default();<br>});</pre><p>In this example, import(&#39;./DynamicComponent&#39;) is a dynamic import statement. It tells Webpack to create a separate bundle for DynamicComponent, and it loads the module when the import is executed.</p><p>After configuring Webpack and using dynamic imports, you can build your project to generate the code bundles with code splitting.</p><h3>Conclusion</h3><p>In this article, we’ve explored a range of code splitting techniques, including dynamic imports, lazy loading using React Lazy, route-based splitting, and the essential role of Webpack. By implementing these strategies, you can significantly enhance your web application’s performance, creating a faster and more responsive user experience.</p><p>While this article has equipped you with a solid foundation, there’s still more to discover in the realm of code splitting. In future articles, we’ll delve even deeper, exploring advanced techniques such as code splitting within Server-Side Rendering (SSR), data fetching strategies, and utilizing third-party libraries like Loadable. These insights will empower you to fine-tune your web applications, ensuring they remain on the cutting edge of web performance.</p><p>Also, the concept of “Lazy Loading” is all about making your application <em>faster </em>and <em>dynamic.</em> Funny, isn’t it?</p><h3>Resources</h3><ol><li>“React Code Splitting” — Official React documentation. <a href="https://reactjs.org/docs/code-splitting.html">Link</a></li><li>“Lazy Loading “— MDN Web Docs provides an overview of Lazy Loading. <a href="https://developer.mozilla.org/en-US/docs/Web/Performance/Lazy_loading">Link</a></li><li>“React Lazy and Suspense” — React documentation on React.lazy() and Suspense. <a href="https://react.dev/reference/react/lazy">Link</a></li><li>“React Router” — Official documentation for React Router. <a href="https://reactrouter.com/">Link</a></li><li>“Webpack SplitChunks Plugin” — Webpack documentation. <a href="https://webpack.js.org/plugins/split-chunks-plugin/">Link</a></li></ol><h3>In Plain English</h3><p><em>Thank you for being a part of our community! Before you go:</em></p><ul><li><em>Be sure to </em><strong><em>clap</em></strong><em> and </em><strong><em>follow</em></strong><em> the writer! 👏</em></li><li><em>You can find even more content at </em><a href="https://plainenglish.io/"><strong><em>PlainEnglish.io</em></strong></a><strong><em> 🚀</em></strong></li><li><em>Sign up for our </em><a href="http://newsletter.plainenglish.io/"><strong><em>free weekly newsletter</em></strong></a><em>. 🗞️</em></li><li><em>Follow us: </em><a href="https://twitter.com/inPlainEngHQ"><strong><em>Twitter</em></strong></a><strong><em>(X</em></strong>), <a href="https://www.linkedin.com/company/inplainenglish/"><strong><em>LinkedIn</em></strong></a>, <a href="https://www.youtube.com/channel/UCtipWUghju290NWcn8jhyAw"><strong><em>YouTube</em></strong></a>, <a href="https://discord.gg/in-plain-english-709094664682340443"><strong><em>Discord</em></strong></a><strong><em>.</em></strong></li><li><em>Check out our other platforms: </em><a href="https://stackademic.com/"><strong><em>Stackademic</em></strong></a>, <a href="https://cofeed.app/"><strong><em>CoFeed</em></strong></a>, <a href="https://venturemagazine.net/"><strong><em>Venture</em></strong></a>.</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3d18acb6c18c" width="1" height="1" alt=""><hr><p><a href="https://javascript.plainenglish.io/code-splitting-the-what-why-and-how-3d18acb6c18c">Code Splitting — The What, Why and How</a> was originally published in <a href="https://javascript.plainenglish.io/">JavaScript in Plain English</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Squashing Commits — Rebase v/s Merge]]></title>
            <link>https://blog.stackademic.com/squashing-commits-rebase-v-s-merge-4a3b300dfd4a?source=rss-ffb1329990c------2</link>
            <guid isPermaLink="false">https://medium.com/p/4a3b300dfd4a</guid>
            <category><![CDATA[git-merge-vs-rebase]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[github]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[git]]></category>
            <dc:creator><![CDATA[Uddeshya]]></dc:creator>
            <pubDate>Sat, 07 Oct 2023 13:18:50 GMT</pubDate>
            <atom:updated>2023-11-04T12:12:43.638Z</atom:updated>
            <content:encoded><![CDATA[<h3>Squashing Commits — Rebase v/s Merge</h3><h4>How are they different and which one should you choose?</h4><figure><img alt="Lego Captain America v/s Lego Iron Man" src="https://cdn-images-1.medium.com/max/1024/0*qdbPm8kXPYu7tvNw" /><figcaption>Photo by <a href="https://unsplash.com/@wacalke?utm_source=medium&amp;utm_medium=referral">Mateusz Wacławek</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>You are working on a <em>feature </em>branch, and you make many commits. There is nothing wrong with it, but sometimes you prefer a clean, concise, single commit over multiple for your Git log to look pretty. Plus, there is no harm in getting rid of those well-written commit messages like “WIP”.</p><p>Jane suggests <strong>Squashing all the Commits </strong>into a single commit and pushing that to the remote branch. John suggests using the <strong>Squash and Merge </strong>feature in GitHub while merging your Pull Request (which contains all your commits).</p><p>Now you wonder, what is the difference between those 2? Which one should you choose? That’s what I am going to answer in this post.</p><figure><img alt="A board stating that the Answers is 1 km away." src="https://cdn-images-1.medium.com/max/1024/0*IK7QrFcS4XRREVX7" /><figcaption>Photo by <a href="https://unsplash.com/@hadijasaidi?utm_source=medium&amp;utm_medium=referral">Hadija Saidi</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><h3><strong>What</strong> is Squashing?</h3><p>Squashing commits in Git means to combine multiple commits into a single commit.</p><p>For example, a <em>feature </em>branch has three commits, A, B and C, with their commit messages. After squashing all the commits, you would have one commit, D, with one commit message.</p><h4><strong>Why </strong>do we squash?</h4><p>As already said, squashing can improve <strong>Readability </strong>of the commit history.<br>For example, an “unsquashed” Git log may look like this:</p><pre>lp48dh3k... add unit test cases<br>1dfg44hd... implement menu feature - JIRA-13<br>kjn74hh2... wip<br>87hdb3xv... implement side bar #12<br>86dg317b... todo add colour to the tiles<br>oi361aqh... implement header JIRA-11<br>09hdj23c... minor fix</pre><p>It doesn’t look pretty. Whereas, a clean Git log with concise commit messages may look something like the following:</p><pre>1dfg44hd... [JIRA-13] Add drop-down menu to the Dashboard<br>87hdb3xv... [JIRA-12] Implement side navigation bar<br>oi361aqh... [JIRA-11] Implement a quick links header</pre><p>Squashing can also make <strong>Cherry Picking</strong> easier. Cherry picking is the act of picking a commit from a branch and applying it to another.</p><p>Let’s say all the above commits are made to a branch, <em>develop, </em>and you want to work on the feature JIRA-13 in another branch <em>feature. </em>In the first scenario, where all the commits are <em>unsquashed</em>, you would have to cherry-pick all the commits that are part of that feature.</p><pre>1dfg44hd... implement menu feature - JIRA-13<br>lp48dh3k... add unit test cases<br>kjn74hh2... wip</pre><p>It can be time-consuming and carries a risk of selecting wrong commits. But, in the second scenario, all of the commits are squashed, and you would have to cherry-pick only one commit:</p><pre>1dfg44hd... [JIRA-13] Add drop-down menu to the Dashboard</pre><p>This makes the cherry picking very easy and quick.</p><h4><strong>How </strong>do we squash?</h4><p>There are two main ways in which we can squash commits:</p><ol><li>Using Git’s <strong>Interactive Rebase</strong>.</li><li>Squashing while<strong> Merging</strong>.</li></ol><h3>Interactive Rebase</h3><figure><img alt="A hand stacking colourful wooden playing pieces on top of each other." src="https://cdn-images-1.medium.com/max/1024/0*UnPi-iOAefCCwlT9" /><figcaption>Photo by <a href="https://unsplash.com/@lastnameeaster?utm_source=medium&amp;utm_medium=referral">La-Rel Easter</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><h4>What is Interactive Rebase?</h4><p>Interactive Rebase is a powerful tool that allows you to squash multiple commits into a single commit. This can be incredibly helpful in cleaning up your Git history and making it easier to understand.</p><h4>Why use Interactive Rebase?</h4><p>There are several reasons why you might want to use Git’s Interactive Rebase to squash commits.</p><p>First, it can help to make your Git history more <strong>readable and organised</strong>.</p><p>Another reason to use Git’s Interactive Rebase to squash commits is to make it <strong>easier to cherry pick</strong> changes to other branches or repositories..</p><p>Apart from squashing, Interactive Rebase also allows you to <strong>drop commits, reword commit messages, and add new files</strong>.</p><p>(In this article, I’m not going to tell you how to use the Interactive Rebase. There are plenty of articles and tutorials available online for that.)</p><h3>Squash and Merge</h3><figure><img alt="Two railway tracks merging into one on a hill surrounded by hills and trees." src="https://cdn-images-1.medium.com/max/1024/0*WWTq44RWN9s5wRqR" /><figcaption>Photo by <a href="https://unsplash.com/@lg17?utm_source=medium&amp;utm_medium=referral">Lance Grandahl</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><h4>What is Squash and Merge?</h4><p>Squash and merge is an option on a pull request on GitHub.com which allows the pull request’s commits to be squashed into a single commit.</p><figure><img alt="A screenshot of a pull request on GitHub with Squash and merge option highlighted." src="https://cdn-images-1.medium.com/max/960/1*GXHhE3GtpQ9_dlS7qlBRpA.png" /><figcaption>Squash and merge on a Pull Request on GitHub.com</figcaption></figure><h4>Why use Squash and Merge?</h4><p>Imagine you’re working on a feature. You create a pull request with your changes and get some feedback. You update your pull request by adding another commit that addresses the feedback. Maybe you notice a typo. So, you create another commit that fixes the typo. Very soon, your feature branch will have a lot going on with all these commits:</p><pre>1dfg44hd... implement menu feature - JIRA-13<br>lp48dh3k... remove console log<br>kjn74hh2... fix typo</pre><p>Merging your pull request with these commits is not only going to make your commit history look busy, but it’ll also make it a lot harder to navigate. Many of these commits don’t add value to your repo’s history.</p><p>Squash and merge will allow you to <strong>squash all these commits into one</strong> (hopefully with a meaningful message) before merging your pull request.</p><p>Now, you have only <strong>one commit per pull request or feature,</strong> making it easier to trace the commit history and attribute changes to specific tasks.</p><h3>Which One Should You Choose?</h3><figure><img alt="A hand holding a small, red and white coloured, ball shaped toy (pokeball)." src="https://cdn-images-1.medium.com/max/1024/0*LHSdZg3MB3FjBZdo" /><figcaption>Photo by <a href="https://unsplash.com/@16bitspixelz?utm_source=medium&amp;utm_medium=referral">Kamil S</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>Choosing a method depends on where you are in your development process.</p><p>If your commits are on your <strong>local branch</strong>, <strong>not yet pushed to a remote branch</strong>, then Interactive Rebase is a clear choice for you. You can add as many “WIP” commits as you like. When satisfied with the changes, you can squash them and push them to the remote branch.</p><p>But what if you have <strong>already pushed your commits to a remote branch</strong>? In that case, you can use either of the methods we discussed, but you’ll have to keep a few things in mind.</p><p>Interactive Rebase:</p><ol><li><strong>Rebase </strong>(Standard and Interactive) rewrites history on top of a branch. This provides a linear history, meaning context is lost of where a feature branched off but it also allows for rollbacks.</li><li>You may have to force push changes (since you are rewriting history) if you have already pushed to a remote.</li><li>It is useful for cherry-picking commits to other branches or repositories.</li></ol><p>Squash and merge:</p><ol><li>For small changes, <strong>Squash and merge </strong>is the easiest option.</li><li>It will always be better to delete the feature branch after squash and merge as if we will do the development in the feature branch and try to merge new single commits with <em>main</em> it will show the previous + new commit as well.</li><li>If you still want to do the changes in the feature branch you have to do rebasing with the main branch.</li></ol><h3>Conclusion</h3><p>Our goal is to maintain a clean, readable and organised history, which will promote collaboration and quicker development, and there are multiple ways to achieve it.</p><p>You can either Squash your commits while rebasing your branch or squash them right before you merge them to your main branch.</p><p>It’s up to you what path you choose.</p><p>Are you on <strong>Team Rebase</strong> or <strong>Team Merge</strong>?</p><h3>Stackademic</h3><p><em>Thank you for reading until the end. Before you go:</em></p><ul><li><em>Please consider </em><strong><em>clapping</em></strong><em> and </em><strong><em>following</em></strong><em> the writer! 👏</em></li><li><em>Follow us on </em><a href="https://twitter.com/stackademichq"><strong><em>Twitter(X)</em></strong></a><em>, </em><a href="https://www.linkedin.com/company/stackademic"><strong><em>LinkedIn</em></strong></a><em>, and </em><a href="https://www.youtube.com/c/stackademic"><strong><em>YouTube</em></strong></a><strong><em>.</em></strong></li><li><em>Visit </em><a href="http://stackademic.com/"><strong><em>Stackademic.com</em></strong></a><em> to find out more about how we are democratizing free programming education around the world.</em></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4a3b300dfd4a" width="1" height="1" alt=""><hr><p><a href="https://blog.stackademic.com/squashing-commits-rebase-v-s-merge-4a3b300dfd4a">Squashing Commits — Rebase v/s Merge</a> was originally published in <a href="https://blog.stackademic.com/">Stackademic</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>