<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
    <title>Tech Cafe - configuration</title>
    <subtitle>Dev adventures, epic bugs, tiny wins, and the occasional meltdown.</subtitle>
    <link rel="self" type="application/atom+xml" href="https://golden-fox.dev/tags/configuration/atom.xml"/>
    <link rel="alternate" type="text/html" href="https://golden-fox.dev"/>
    <generator uri="https://www.getzola.org/">Zola</generator>
    <updated>2026-02-05T00:00:00+00:00</updated>
    <id>https://golden-fox.dev/tags/configuration/atom.xml</id>
    <entry xml:lang="en">
        <title>Managing Multiple Git Identities on One Machine</title>
        <published>2026-02-05T00:00:00+00:00</published>
        <updated>2026-02-05T00:00:00+00:00</updated>
        
        <author>
          <name>
            
              Aakriti Agarwal
            
          </name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://golden-fox.dev/til/git-identities/"/>
        <id>https://golden-fox.dev/til/git-identities/</id>
        
        <content type="html" xml:base="https://golden-fox.dev/til/git-identities/">&lt;p&gt;&lt;strong&gt;TL;DR: Want separate Git emails per project? Just don’t use &lt;code&gt;--global&lt;&#x2F;code&gt;.&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;The Problem:&lt;&#x2F;strong&gt; So I ran into this situation where I needed one project folder to use my university credentials while keeping my personal Gmail for literally everything else in VS Code. Classic identity crisis, but make it Git.&lt;&#x2F;p&gt;
&lt;p&gt;Honestly thought this would be a nightmare to set up, but Git actually makes it pretty straightforward once you know the trick.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;solution-local-vs-global-git-config&quot;&gt;Solution: Local vs Global Git Config&lt;&#x2F;h3&gt;
&lt;p&gt;Here is the thing I wish someone had told me earlier: &lt;strong&gt;stop using &lt;code&gt;--global&lt;&#x2F;code&gt; for everything.&lt;&#x2F;strong&gt; I know it is tempting (one command and you are done!), but global configs apply to every single repository on your machine. Not ideal when you are trying to keep things separate.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;For personal identity  (global):&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color-scheme: light dark; color: light-dark(#657B83, #839496); background-color: light-dark(#FDF6E3, #002B36);&quot;&gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#268BD2, #268BD2);&quot;&gt;git&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#2AA198, #2AA198);&quot;&gt; config&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#CB4B16, #CB4B16);&quot;&gt; -&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#CB4B16, #CB4B16);&quot;&gt;-global&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#2AA198, #2AA198);&quot;&gt; user.name&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#2AA198, #2AA198);&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#2AA198, #2AA198);&quot;&gt;personal username&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#2AA198, #2AA198);&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#268BD2, #268BD2);&quot;&gt;git&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#2AA198, #2AA198);&quot;&gt; config&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#CB4B16, #CB4B16);&quot;&gt; -&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#CB4B16, #CB4B16);&quot;&gt;-global&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#2AA198, #2AA198);&quot;&gt; user.email&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#2AA198, #2AA198);&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#2AA198, #2AA198);&quot;&gt;personal email&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#2AA198, #2AA198);&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;&lt;strong&gt;For uni project (local: run this inside that specific folder):&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color-scheme: light dark; color: light-dark(#657B83, #839496); background-color: light-dark(#FDF6E3, #002B36);&quot;&gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#268BD2, #268BD2);&quot;&gt;git&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#2AA198, #2AA198);&quot;&gt; config&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#2AA198, #2AA198);&quot;&gt; user.name&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#2AA198, #2AA198);&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#2AA198, #2AA198);&quot;&gt;uni username&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#2AA198, #2AA198);&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#268BD2, #268BD2);&quot;&gt;git&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#2AA198, #2AA198);&quot;&gt; config&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#2AA198, #2AA198);&quot;&gt; user.email&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#2AA198, #2AA198);&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#2AA198, #2AA198);&quot;&gt;uni email&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#2AA198, #2AA198);&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;See the difference? No &lt;code&gt;--global&lt;&#x2F;code&gt; flag means the config only applies to that one repository. Problem  solved.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Paranoid and want to verify?&lt;&#x2F;strong&gt; I found this super helpful command to check which email was actually used for your last commit:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color-scheme: light dark; color: light-dark(#657B83, #839496); background-color: light-dark(#FDF6E3, #002B36);&quot;&gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#268BD2, #268BD2);&quot;&gt;git&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#2AA198, #2AA198);&quot;&gt; show&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#CB4B16, #CB4B16);&quot;&gt; -&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#CB4B16, #CB4B16);&quot;&gt;s&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#CB4B16, #CB4B16);&quot;&gt; -&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#CB4B16, #CB4B16);&quot;&gt;-format=&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#2AA198, #2AA198);&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#2AA198, #2AA198);&quot;&gt;Author: %ae%nCommitter: %ce&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#2AA198, #2AA198);&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#2AA198, #2AA198);&quot;&gt; HEAD&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;This shows you both the author and committer email from your most recent commit. Saved me from some potential embarrassment when I wasn’t sure if I had configured things correctly!&lt;&#x2F;p&gt;
&lt;h3 id=&quot;bonus-learning-git-reset-flags-proceed-with-caution&quot;&gt;Bonus Learning: Git Reset Flags (Proceed with Caution)&lt;&#x2F;h3&gt;
&lt;p&gt;I also learned about &lt;code&gt;git reset&lt;&#x2F;code&gt; and honestly it is Kind of terrifying.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;&lt;code&gt;git reset --soft HEAD~1&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt;: Removes your last commit but keeps all your changes staged. Perfect for those “oops, typo in the commit message” moments. Very forgiving, 10&#x2F;10 would use again.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;&lt;code&gt;git reset --hard HEAD~1&lt;&#x2F;code&gt;&lt;&#x2F;strong&gt;: Deletes the last commit AND all your changes. Like completely GONE. Forever. No take-backs. (Yeah… never gonna try using &lt;code&gt;--hard&lt;&#x2F;code&gt; unless I am absolutely certain and have sacrificed the appropriate offerings to the Git gods.)&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;&lt;strong&gt;Real talk:&lt;&#x2F;strong&gt; Always double-check before using &lt;code&gt;--hard&lt;&#x2F;code&gt;. Your past self worked hard on that code, and your future self will definitely not appreciate having to rewrite everything at midnight.&lt;&#x2F;p&gt;
</content>
        
    </entry>
</feed>
