<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>git on semikolan</title>
    <link>https://semikolan.me/tags/git/</link>
    <description>Recent content in git on semikolan</description>
    <generator>Hugo</generator>
    <language>en</language>
    <lastBuildDate>Mon, 27 Jul 2026 21:19:11 +0530</lastBuildDate>
    <atom:link href="https://semikolan.me/tags/git/index.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>git switch beats git checkout</title>
      <link>https://semikolan.me/til/git-switch-vs-checkout/</link>
      <pubDate>Thu, 09 Jul 2026 00:00:00 +0000</pubDate>
      <guid>https://semikolan.me/til/git-switch-vs-checkout/</guid>
      <description>&lt;p&gt;&lt;code&gt;git checkout&lt;/code&gt; does too much: it moves branches, restores files, detaches HEAD, and creates branches — all under one overloaded verb. That&amp;rsquo;s why it&amp;rsquo;s a classic source of &amp;ldquo;I ran the right command and lost my changes.&amp;rdquo;&lt;/p&gt;&#xA;&lt;p&gt;Since Git 2.23 the job is split into two honest commands:&lt;/p&gt;&#xA;&lt;div class=&#34;chroma&#34;&gt;&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-sh&#34; data-lang=&#34;sh&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;git switch -c new-feature   &lt;span class=&#34;c1&#34;&gt;# create and move to a branch&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;git switch main             &lt;span class=&#34;c1&#34;&gt;# move to an existing branch&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;git restore path/to/file    &lt;span class=&#34;c1&#34;&gt;# discard changes to a file&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;&lt;code&gt;switch&lt;/code&gt; only changes branches. &lt;code&gt;restore&lt;/code&gt; only touches files. The name tells you the blast radius before you hit enter.&lt;/p&gt;</description>
    </item>
    <item>
      <title>git commit --fixup and autosquash</title>
      <link>https://semikolan.me/til/git-fixup-autosquash/</link>
      <pubDate>Thu, 02 Jul 2026 00:00:00 +0000</pubDate>
      <guid>https://semikolan.me/til/git-fixup-autosquash/</guid>
      <description>&lt;p&gt;When review feedback belongs in a commit three back, you don&amp;rsquo;t have to hand-edit a rebase todo. Mark the fix, then let Git sort it:&lt;/p&gt;&#xA;&lt;div class=&#34;chroma&#34;&gt;&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-sh&#34; data-lang=&#34;sh&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;git commit --fixup&lt;span class=&#34;o&#34;&gt;=&lt;/span&gt;&amp;lt;sha&amp;gt;          &lt;span class=&#34;c1&#34;&gt;# stages a &amp;#34;fixup! &amp;lt;subject&amp;gt;&amp;#34; commit&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;git rebase -i --autosquash main   &lt;span class=&#34;c1&#34;&gt;# reorders and squashes it automatically&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;&lt;code&gt;--fixup&lt;/code&gt; writes a specially-named commit; &lt;code&gt;--autosquash&lt;/code&gt; recognizes the name, moves it next to its target, and pre-marks it as &lt;code&gt;fixup&lt;/code&gt; in the todo list. You just confirm. Set &lt;code&gt;git config --global rebase.autosquash true&lt;/code&gt; and the flag is on by default.&lt;/p&gt;</description>
    </item>
  </channel>
</rss>
