<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>Forem: Luis Sebastian Urrutia Fuentes</title>
    <description>The latest articles on Forem by Luis Sebastian Urrutia Fuentes (@luisurrutia).</description>
    <link>https://forem.com/luisurrutia</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F1245148%2F1d70ce69-0a9b-46dc-8221-2106f70e1daf.jpeg</url>
      <title>Forem: Luis Sebastian Urrutia Fuentes</title>
      <link>https://forem.com/luisurrutia</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/luisurrutia"/>
    <language>en</language>
    <item>
      <title>Git Worktree: The Interruption-Proof Workflow</title>
      <dc:creator>Luis Sebastian Urrutia Fuentes</dc:creator>
      <pubDate>Tue, 03 Feb 2026 19:32:47 +0000</pubDate>
      <link>https://forem.com/luisurrutia/git-worktree-the-interruption-proof-workflow-51nh</link>
      <guid>https://forem.com/luisurrutia/git-worktree-the-interruption-proof-workflow-51nh</guid>
      <description>&lt;p&gt;You're deep in a feature branch. Dev server running. Uncommitted changes across a dozen files. &lt;em&gt;Finally&lt;/em&gt; in flow. Then Slack pings: "Hey, can you look into this customer issue?" Or worse: "Can you implement this ASAP?"&lt;/p&gt;

&lt;p&gt;You need to switch branches, but your changes aren't ready to commit. I don't like committing unfinished work. And even if I wanted to make a quick WIP commit, the pre-commit hooks won't let me. Linting fails. Tests don't pass. The commit gets rejected.&lt;/p&gt;

&lt;p&gt;So the ritual begins. &lt;code&gt;git stash&lt;/code&gt;. Switch branches. Fix the thing. Switch back. &lt;code&gt;git stash pop&lt;/code&gt;. Hope nothing conflicts. Somewhere in that shuffle, you've lost &lt;strong&gt;20 minutes&lt;/strong&gt; and whatever mental state got you into flow.&lt;/p&gt;

&lt;p&gt;I did this for years. Turns out there's been a better way since 2015, &lt;em&gt;hiding in plain sight&lt;/em&gt;: git worktree creates separate working directories for different branches, all linked to the same repository. Your feature branch stays open in one folder while you fix the hotfix in another. &lt;strong&gt;No stashing. No fighting pre-commit hooks.&lt;/strong&gt; Your work stays exactly where you left it.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fw7xsq9wcpku5kqqll4pv.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fw7xsq9wcpku5kqqll4pv.png" alt="Split terminal showing two branches open simultaneously in separate directories" width="800" height="427"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Why pre-commit hooks make the stash problem worse
&lt;/h2&gt;

&lt;p&gt;The stash workflow was annoying before teams started using pre-commit hooks. Now it's a &lt;em&gt;real&lt;/em&gt; pain.&lt;/p&gt;

&lt;p&gt;You can't just make a quick WIP commit to save your place. The hooks run linting, type checking, tests. Unfinished code fails all of them. So you're forced to stash, even when you'd rather commit.&lt;/p&gt;

&lt;p&gt;And stashing has its own problems. Which stash was for this branch? Did you include untracked files? Will the pop conflict with changes you made in the other branch? It's a small gamble every time.&lt;/p&gt;

&lt;p&gt;Git worktrees skip all of this. Each worktree has its own working directory. You can leave your feature branch mid-thought, with uncommitted changes everywhere, and open a completely separate folder for the urgent fix. When you come back, &lt;strong&gt;everything is exactly as you left it&lt;/strong&gt;. Server still running. Files still modified. No digging through old stashes.&lt;/p&gt;

&lt;h2&gt;
  
  
  The friction that kept worktrees hidden for a decade
&lt;/h2&gt;

&lt;p&gt;Git added worktrees in version 2.5, released July 2015. &lt;em&gt;Over ten years ago.&lt;/em&gt; Yet most developers I talk to have never used them.&lt;/p&gt;

&lt;p&gt;The problem isn't the feature. It's &lt;strong&gt;the UX&lt;/strong&gt;. Creating a worktree requires typing the branch name three times:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git worktree add &lt;span class="nt"&gt;-b&lt;/span&gt; hotfix ../repo.hotfix &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="nb"&gt;cd&lt;/span&gt; ../repo.hotfix
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Compare that to &lt;code&gt;git checkout -b hotfix&lt;/code&gt;. The overhead adds up, and most people give up before they see the benefit.&lt;/p&gt;

&lt;p&gt;This is where &lt;a href="https://worktrunk.dev" rel="noopener noreferrer"&gt;Worktrunk&lt;/a&gt; comes in. It's a CLI that makes worktrees as easy as branches. The same operation becomes:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;wt switch &lt;span class="nt"&gt;-c&lt;/span&gt; hotfix
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Worktrunk addresses worktrees by branch name instead of paths. It handles directory management automatically. It supports hooks to automate setup, so you can have it run &lt;code&gt;npm install&lt;/code&gt; or copy &lt;code&gt;.env&lt;/code&gt; files every time you create a new worktree. When you're ready to merge, &lt;code&gt;wt merge&lt;/code&gt; handles squashing, rebasing, and cleanup in one command.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F9x0qarnkiiudi5j7mhj5.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F9x0qarnkiiudi5j7mhj5.png" alt="Side-by-side comparison of git worktree commands versus Worktrunk equivalents" width="800" height="233"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Why worktrees are suddenly everywhere
&lt;/h2&gt;

&lt;p&gt;Worktrees existed quietly for a decade. So why are developers suddenly talking about them?&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;AI coding assistants.&lt;/strong&gt; Tools like Claude Code can work autonomously, and developers are using worktrees to give each agent its own isolated sandbox.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://x.com/dhh/status/2005326958578856206" rel="noopener noreferrer"&gt;DHH&lt;/a&gt; (creator of Ruby on Rails) put it simply: "Git worktrees are perfect for starting sandboxes for agents to propose a solution to a problem while you keep working on master or another branch."&lt;/p&gt;

&lt;p&gt;That's not why I started using worktrees, though. For me it was simpler: I got tired of the stash-switch-unstash dance every time someone needed something urgent. The AI use case is interesting, but the everyday interruption problem was reason enough.&lt;/p&gt;

&lt;h2&gt;
  
  
  What actually changed for me
&lt;/h2&gt;

&lt;p&gt;I used to think switching branches was just part of the job. Stash, switch, pop. Repeat. Or worse: fight with pre-commit hooks, give up, stash anyway.&lt;/p&gt;

&lt;p&gt;Now when someone pings me with something urgent, I run &lt;code&gt;wt switch -c hotfix&lt;/code&gt;, handle it in a separate folder, and come back to my feature branch exactly as I left it. Server still running. Changes still there. &lt;strong&gt;No lost context.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Interruptions don't derail me the way they used to. I'm not losing 20 minutes reconstructing where I was. I'm not gambling on stash conflicts.&lt;/p&gt;

&lt;p&gt;If you've been playing &lt;em&gt;stash roulette&lt;/em&gt;, there's a better way. Try creating a worktree next time you're interrupted:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;brew &lt;span class="nb"&gt;install &lt;/span&gt;worktrunk &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; wt config shell &lt;span class="nb"&gt;install&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;p&gt;&lt;strong&gt;Learn more:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://worktrunk.dev" rel="noopener noreferrer"&gt;Worktrunk CLI&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://git-scm.com/docs/git-worktree" rel="noopener noreferrer"&gt;Official git worktree documentation&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;em&gt;What Git feature took you embarrassingly long to discover? I'm curious what else I might be missing.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>git</category>
      <category>productivity</category>
      <category>development</category>
    </item>
  </channel>
</rss>
