<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:webfeeds="http://webfeeds.org/rss/1.0">
  <channel>
    <title>Git on staticnotes.org</title>
    <link>https://staticnotes.org/tags/git/</link>
    <webfeeds:icon>https://staticnotes.org/logo.png</webfeeds:icon>
    <webfeeds:logo>https://staticnotes.org/logo.png</webfeeds:logo>
    <description>Recent content in Git on staticnotes.org</description>
    <generator>Hugo -- gohugo.io</generator>
    <language>en-US</language>
    <copyright>staticnotes.org (CC BY-NC-SA 4.0)</copyright>
    <lastBuildDate>Fri, 28 Nov 2025 16:20:00 +0000</lastBuildDate><atom:link href="https://staticnotes.org/tags/git/index.xml" rel="self" type="application/rss+xml" /><image>
      <url>https://staticnotes.org/logo.png</url>
      <title>staticnotes.org</title>
      <link>https://staticnotes.org/tags/git/</link>
    </image>
    
    <item>
      <title>TIL how to set up multiple SSH keys (for multiple GitHub accounts)</title>
      <link>https://staticnotes.org/til/2025/11/how-to-set-up-multiple-ssh-keys/</link>
      <pubDate>Fri, 28 Nov 2025 16:20:00 +0000</pubDate>
      
      <guid>https://staticnotes.org/til/2025/11/how-to-set-up-multiple-ssh-keys/</guid>
      <description>&lt;p&gt;Setting up SSH keys is one of these things I need to do every couple of months. Inevitably, I don&amp;rsquo;t remember how to do it and then follow some tutorial, e.g. the &lt;a href=&#34;https://docs.github.com/en/authentication/connecting-to-github-with-ssh/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent&#34; &#xA;&#xA;    target=&#34;_blank&#34;&#xA;    &gt;GitHub Docs&#xA;    &#xA;        &lt;span style=&#34;white-space: nowrap&#34;&gt;&amp;thinsp;&lt;svg&#xA;            style=&#34;height: 0.7em; width: 0.7em; padding-left: -0.2em;&#34; focusable=&#34;false&#34; data-prefix=&#34;fas&#34; data-icon=&#34;external-link-alt&#34;&#xA;            class=&#34;svg-inline--fa fa-external-link-alt fa-w-16&#34; role=&#34;img&#34; xmlns=&#34;http://www.w3.org/2000/svg&#34;&#xA;            viewBox=&#34;0 0 512 512&#34;&gt;&#xA;            &lt;path fill=&#34;currentColor&#34;&#xA;                d=&#34;M432,320H400a16,16,0,0,0-16,16V448H64V128H208a16,16,0,0,0,16-16V80a16,16,0,0,0-16-16H48A48,48,0,0,0,0,112V464a48,48,0,0,0,48,48H400a48,48,0,0,0,48-48V336A16,16,0,0,0,432,320ZM488,0h-128c-21.37,0-32.05,25.91-17,41l35.73,35.73L135,320.37a24,24,0,0,0,0,34L157.67,377a24,24,0,0,0,34,0L435.28,133.32,471,169c15,15,41,4.5,41-17V24A24,24,0,0,0,488,0Z&#34;&gt;&#xA;            &lt;/path&gt;&#xA;        &lt;/svg&gt;&#xA;    &lt;/span&gt;&#xA;        &#xA;    &#xA;&lt;/a&gt;. It kind of always works but I haven&amp;rsquo;t fully internalised how to properly manage those different SSH keys.&lt;/p&gt;&#xA;&lt;p&gt;&lt;em&gt;Disclaimer&lt;/em&gt;: This learning was provoked by setting up multiple SSH keys for different GitHub accounts (I know how to do that) and then being able to &lt;code&gt;git clone {private-repository}&lt;/code&gt; a private repository with the correct ssh key (I didn&amp;rsquo;t know how to do that). An example use case could be a personal and professional GitHub account that don&amp;rsquo;t have access to the same private repositories. So ideally when we git clone we want to automatically pick the right ssh key.&lt;/p&gt;&#xA;&lt;h3 id=&#34;1-generate-the-ssh-keys-for-each-account&#34; class=&#34;content-heading&#34;&gt;1. Generate the SSH keys for each account&#xA;&lt;/h3&gt;&#xA;&lt;p&gt;Let&amp;rsquo;s assume we want to generate new separate ssh keys for each account. I like to have them all in my &lt;code&gt;~/.ssh&lt;/code&gt; folder.&#xA;We can use the key generation command&lt;/p&gt;&#xA;&lt;div class=&#34;code-block&#34; data-lang=&#34;bash&#34;&gt;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;$ &lt;span class=&#34;nb&#34;&gt;cd&lt;/span&gt; ~/.ssh&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;$ ssh-keygen -t ed25519 -C &lt;span class=&#34;s2&#34;&gt;&amp;#34;your_email or your_name&amp;#34;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&#xA;&lt;p&gt;where we specify the encryption type (&lt;code&gt;-t&lt;/code&gt;) as &lt;code&gt;ed25519&lt;/code&gt; which is &lt;a href=&#34;https://en.wikipedia.org/wiki/EdDSA#Ed25519&#34; &#xA;&#xA;    target=&#34;_blank&#34;&#xA;    &gt;Edwards-curve Digital Signature Algorithm&#xA;    &#xA;        &lt;span style=&#34;white-space: nowrap&#34;&gt;&amp;thinsp;&lt;svg&#xA;                style=&#34;height: 0.7em; width: 0.7em; margin-left: -0.2em;&#34; focusable=&#34;false&#34; data-prefix=&#34;fas&#34; data-icon=&#34;external-link-alt&#34;&#xA;                class=&#34;svg-inline--fa fa-external-link-alt fa-w-16&#34; role=&#34;img&#34; xmlns=&#34;http://www.w3.org/2000/svg&#34;&#xA;                viewBox=&#34;0 0 640 512&#34;&gt;&#xA;                &lt;path fill=&#34;currentColor&#34;&#xA;                    d=&#34;M640 51.2l-.3 12.2c-28.1 .8-45 15.8-55.8 40.3-25 57.8-103.3 240-155.3 358.6H415l-81.9-193.1c-32.5 63.6-68.3 130-99.2 193.1-.3 .3-15 0-15-.3C172 352.3 122.8 243.4 75.8 133.4 64.4 106.7 26.4 63.4 .2 63.7c0-3.1-.3-10-.3-14.2h161.9v13.9c-19.2 1.1-52.8 13.3-43.3 34.2 21.9 49.7 103.6 240.3 125.6 288.6 15-29.7 57.8-109.2 75.3-142.8-13.9-28.3-58.6-133.9-72.8-160-9.7-17.8-36.1-19.4-55.8-19.7V49.8l142.5 .3v13.1c-19.4 .6-38.1 7.8-29.4 26.1 18.9 40 30.6 68.1 48.1 104.7 5.6-10.8 34.7-69.4 48.1-100.8 8.9-20.6-3.9-28.6-38.6-29.4 .3-3.6 0-10.3 .3-13.6 44.4-.3 111.1-.3 123.1-.6v13.6c-22.5 .8-45.8 12.8-58.1 31.7l-59.2 122.8c6.4 16.1 63.3 142.8 69.2 156.7L559.2 91.8c-8.6-23.1-36.4-28.1-47.2-28.3V49.6l127.8 1.1 .2 .5z&#34;&gt;&#xA;                &lt;/path&gt;&#xA;            &lt;/svg&gt;&#xA;        &lt;/span&gt;&#xA;        &#xA;    &#xA;&lt;/a&gt; and generally &lt;a href=&#34;https://www.latacora.com/blog/cryptographic-right-answers/&#34; &#xA;&#xA;    target=&#34;_blank&#34;&#xA;    &gt;recommended over RSA-based keys&#xA;    &#xA;        &lt;span style=&#34;white-space: nowrap&#34;&gt;&amp;thinsp;&lt;svg&#xA;            style=&#34;height: 0.7em; width: 0.7em; padding-left: -0.2em;&#34; focusable=&#34;false&#34; data-prefix=&#34;fas&#34; data-icon=&#34;external-link-alt&#34;&#xA;            class=&#34;svg-inline--fa fa-external-link-alt fa-w-16&#34; role=&#34;img&#34; xmlns=&#34;http://www.w3.org/2000/svg&#34;&#xA;            viewBox=&#34;0 0 512 512&#34;&gt;&#xA;            &lt;path fill=&#34;currentColor&#34;&#xA;                d=&#34;M432,320H400a16,16,0,0,0-16,16V448H64V128H208a16,16,0,0,0,16-16V80a16,16,0,0,0-16-16H48A48,48,0,0,0,0,112V464a48,48,0,0,0,48,48H400a48,48,0,0,0,48-48V336A16,16,0,0,0,432,320ZM488,0h-128c-21.37,0-32.05,25.91-17,41l35.73,35.73L135,320.37a24,24,0,0,0,0,34L157.67,377a24,24,0,0,0,34,0L435.28,133.32,471,169c15,15,41,4.5,41-17V24A24,24,0,0,0,488,0Z&#34;&gt;&#xA;            &lt;/path&gt;&#xA;        &lt;/svg&gt;&#xA;    &lt;/span&gt;&#xA;        &#xA;    &#xA;&lt;/a&gt;. The comment (&lt;code&gt;-C&lt;/code&gt;) argument allows us to optionally add a comment that is added at the back of the key so that you remember who created it. People often use their email address. However, this is not used anywhere to select the key.&lt;/p&gt;&#xA;&lt;div class=&#34;code-block&#34; data-lang=&#34;bash&#34;&gt;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;$ Generating public/private ed25519 key pair.&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;$ Enter file in which to save the key &lt;span class=&#34;o&#34;&gt;(&lt;/span&gt;/Users/youruser/.ssh/id_ed25519&lt;span class=&#34;o&#34;&gt;)&lt;/span&gt;: /Users/youruser/.ssh/github_personal&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&#xA;&lt;div class=&#34;code-block&#34; data-lang=&#34;bash&#34;&gt;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;$ Enter passphrase &lt;span class=&#34;k&#34;&gt;for&lt;/span&gt; &lt;span class=&#34;s2&#34;&gt;&amp;#34;github_personal&amp;#34;&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;(&lt;/span&gt;empty &lt;span class=&#34;k&#34;&gt;for&lt;/span&gt; no passphrase&lt;span class=&#34;o&#34;&gt;)&lt;/span&gt;: &lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&#xA;&lt;p&gt;This generates both the private and public key &lt;code&gt;github_personal&lt;/code&gt; (private) and &lt;code&gt;github_personal.pub&lt;/code&gt; (public) in the specified path. If we entered a passphrase the private key will be encrypted as well using &lt;a href=&#34;https://en.wikipedia.org/wiki/Triple_DES&#34; &#xA;&#xA;    target=&#34;_blank&#34;&#xA;    &gt;3DES&#xA;    &#xA;        &lt;span style=&#34;white-space: nowrap&#34;&gt;&amp;thinsp;&lt;svg&#xA;                style=&#34;height: 0.7em; width: 0.7em; margin-left: -0.2em;&#34; focusable=&#34;false&#34; data-prefix=&#34;fas&#34; data-icon=&#34;external-link-alt&#34;&#xA;                class=&#34;svg-inline--fa fa-external-link-alt fa-w-16&#34; role=&#34;img&#34; xmlns=&#34;http://www.w3.org/2000/svg&#34;&#xA;                viewBox=&#34;0 0 640 512&#34;&gt;&#xA;                &lt;path fill=&#34;currentColor&#34;&#xA;                    d=&#34;M640 51.2l-.3 12.2c-28.1 .8-45 15.8-55.8 40.3-25 57.8-103.3 240-155.3 358.6H415l-81.9-193.1c-32.5 63.6-68.3 130-99.2 193.1-.3 .3-15 0-15-.3C172 352.3 122.8 243.4 75.8 133.4 64.4 106.7 26.4 63.4 .2 63.7c0-3.1-.3-10-.3-14.2h161.9v13.9c-19.2 1.1-52.8 13.3-43.3 34.2 21.9 49.7 103.6 240.3 125.6 288.6 15-29.7 57.8-109.2 75.3-142.8-13.9-28.3-58.6-133.9-72.8-160-9.7-17.8-36.1-19.4-55.8-19.7V49.8l142.5 .3v13.1c-19.4 .6-38.1 7.8-29.4 26.1 18.9 40 30.6 68.1 48.1 104.7 5.6-10.8 34.7-69.4 48.1-100.8 8.9-20.6-3.9-28.6-38.6-29.4 .3-3.6 0-10.3 .3-13.6 44.4-.3 111.1-.3 123.1-.6v13.6c-22.5 .8-45.8 12.8-58.1 31.7l-59.2 122.8c6.4 16.1 63.3 142.8 69.2 156.7L559.2 91.8c-8.6-23.1-36.4-28.1-47.2-28.3V49.6l127.8 1.1 .2 .5z&#34;&gt;&#xA;                &lt;/path&gt;&#xA;            &lt;/svg&gt;&#xA;        &lt;/span&gt;&#xA;        &#xA;    &#xA;&lt;/a&gt;. We can check out what the keys look like:&lt;/p&gt;&#xA;&lt;div class=&#34;code-block&#34; data-lang=&#34;bash&#34;&gt;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;$ cat github_personal.pub&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIDycaSFXnekEe32AZFhhDp3Q14JRXF7bu8CNfGf7Z6hN your_email &lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&#xA;&lt;p&gt;and&lt;/p&gt;&#xA;&lt;div class=&#34;code-block&#34;&gt;&lt;pre&gt;&lt;code&gt;$ cat github_personal&#xA;&#xA;-----BEGIN OPENSSH PRIVATE KEY-----&#xA;somegibberylongkeyperhapsfurtherencryptedusingpassphrase&#xA;-----END OPENSSH PRIVATE KEY-----&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&#xA;&lt;p&gt;Let&amp;rsquo;s also use the same method to create a keypair for work (&lt;code&gt;github_work&lt;/code&gt;, &lt;code&gt;github_work.pub&lt;/code&gt;). Once we have these keys, we can add them to our two GitHub accounts.&lt;/p&gt;&#xA;&lt;h3 id=&#34;2-associate-the-public-keys-with-the-github-accounts&#34; class=&#34;content-heading&#34;&gt;2. Associate the public keys with the GitHub accounts&#xA;&lt;/h3&gt;&#xA;&lt;p&gt;In both GitHub accounts, navigate to &lt;code&gt;Access:SSH and GPG Keys&lt;/code&gt; -&amp;gt; &lt;code&gt;New SSH key&lt;/code&gt; and add the &lt;strong&gt;public key&lt;/strong&gt; as an &lt;em&gt;Authentication Key&lt;/em&gt; to the account. GitHub now has the ability to verify messages that were signed by the corresponding private key of the pair.&lt;/p&gt;&#xA;&lt;h3 id=&#34;3-set-up-openssh-client-config-file&#34; class=&#34;content-heading&#34;&gt;3. Set up OpenSSH client config file&#xA;&lt;/h3&gt;&#xA;&lt;p&gt;The file &lt;code&gt;~/.ssh/config&lt;/code&gt; allows us to configure &amp;ldquo;Host&amp;rdquo; specifications that we can refer to when using SSH (e.g. when git clone uses the SSH protocol for data transfer). The file looks like this:&lt;/p&gt;&#xA;&lt;div class=&#34;code-block&#34;&gt;&lt;pre&gt;&lt;code&gt;Host hostname1&#xA;    SSH_OPTION value&#xA;    SSH_OPTION value&#xA;&#xA;Host hostname2&#xA;    SSH_OPTION value&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&#xA;&lt;p&gt;In our case, we define the two different github identities that we want to be able to select:&lt;/p&gt;&#xA;&lt;div class=&#34;code-block&#34;&gt;&lt;pre&gt;&lt;code&gt;Host github-personal&#xA;    User git&#xA;    PreferredAuthentications publickey&#xA;    Hostname github.com&#xA;    IdentityFile ~/.ssh/github_personal&#xA;&#xA;Host github-work&#xA;    User git&#xA;    PreferredAuthentications publickey&#xA;    Hostname github.com&#xA;    IdentityFile ~/.ssh/github_work&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&#xA;&lt;p&gt;This defines which keys to use when we connect using SSH via &lt;code&gt;user@host&lt;/code&gt;. So when we test the config by running &lt;code&gt;ssh -T git@github-personal&lt;/code&gt; SSH will use the SSH key &lt;code&gt;~/.ssh/github_personal&lt;/code&gt; as specified in the file. (Note: We can name the host and user whatever we want.)&lt;/p&gt;&#xA;&lt;h3 id=&#34;4-use-the-right-hostname-when-cloning-repositories&#34; class=&#34;content-heading&#34;&gt;4. Use the right hostname when cloning repositories&#xA;&lt;/h3&gt;&#xA;&lt;p&gt;Let&amp;rsquo;s say we want to git clone a repository that only our work account has access to, then I can use the git clone command &lt;code&gt;git clone {user}@{host}:{repo_path}.git&lt;/code&gt;:&lt;/p&gt;&#xA;&lt;div class=&#34;code-block&#34; data-lang=&#34;bash&#34;&gt;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;$ git clone git@github-work:/org1/project1.git&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&#xA;&lt;p&gt;or more explicitly:&lt;/p&gt;&#xA;&lt;div class=&#34;code-block&#34; data-lang=&#34;bash&#34;&gt;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;$ git clone ssh://git@github-work/org1/project.git&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&#xA;&lt;p&gt;git/ssh will look into the &lt;code&gt;config&lt;/code&gt; file and select the configured private key for the provided host.&lt;/p&gt;&#xA;&lt;p&gt;GitHub will send a challenge (message) to our machine for authentication. The private key will be used to sign this challenge and our machine then sends the signed message back to the GitHub server. The GitHub server will use the stored public key (from step 2) to verify the signature and allow a connection.&lt;/p&gt;&#xA;&lt;p&gt;Note: If in step 1) we decided to encrypt the private key with a passphrase we will be prompted to provide it. Normally, at that point MacOS will offer us to add this passphrase to our &lt;a href=&#34;https://support.apple.com/en-gb/guide/keychain-access/welcome/mac&#34; &#xA;&#xA;    target=&#34;_blank&#34;&#xA;    &gt;Keychain&#xA;    &#xA;        &lt;span style=&#34;white-space: nowrap&#34;&gt;&amp;thinsp;&lt;svg&#xA;            style=&#34;height: 0.7em; width: 0.7em; padding-left: -0.2em;&#34; focusable=&#34;false&#34; data-prefix=&#34;fas&#34; data-icon=&#34;external-link-alt&#34;&#xA;            class=&#34;svg-inline--fa fa-external-link-alt fa-w-16&#34; role=&#34;img&#34; xmlns=&#34;http://www.w3.org/2000/svg&#34;&#xA;            viewBox=&#34;0 0 512 512&#34;&gt;&#xA;            &lt;path fill=&#34;currentColor&#34;&#xA;                d=&#34;M432,320H400a16,16,0,0,0-16,16V448H64V128H208a16,16,0,0,0,16-16V80a16,16,0,0,0-16-16H48A48,48,0,0,0,0,112V464a48,48,0,0,0,48,48H400a48,48,0,0,0,48-48V336A16,16,0,0,0,432,320ZM488,0h-128c-21.37,0-32.05,25.91-17,41l35.73,35.73L135,320.37a24,24,0,0,0,0,34L157.67,377a24,24,0,0,0,34,0L435.28,133.32,471,169c15,15,41,4.5,41-17V24A24,24,0,0,0,488,0Z&#34;&gt;&#xA;            &lt;/path&gt;&#xA;        &lt;/svg&gt;&#xA;    &lt;/span&gt;&#xA;        &#xA;    &#xA;&lt;/a&gt;.&lt;/p&gt;&#xA;</description>
    </item>
    
    <item>
      <title>How Core Git Developers Configure Git</title>
      <link>https://staticnotes.org/feed/2025/02/how-core-git-developers-configure-git/</link>
      <pubDate>Tue, 25 Feb 2025 14:02:17 +0000</pubDate>
      
      <guid>https://staticnotes.org/feed/2025/02/how-core-git-developers-configure-git/</guid>
      <description>&lt;p&gt;Interesting discussion of git config options that the git core developers favor and that are not (yet) defaults. There are some nice suggestions. For example, I didn&amp;rsquo;t know that&lt;/p&gt;&#xA;&lt;div class=&#34;code-block&#34; data-lang=&#34;sh&#34;&gt;&lt;div class=&#34;highlight&#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 config --global push.autoSetupRemote true&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&#xA;&lt;p&gt;existed. If you haven&amp;rsquo;t defined an upstream for a branch yet, git will automatically set it for you. So you don&amp;rsquo;t have to run&lt;/p&gt;&#xA;&lt;div class=&#34;code-block&#34; data-lang=&#34;sh&#34;&gt;&lt;div class=&#34;highlight&#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 push --set-upstream origin my-branch-name&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&#xA;&lt;p&gt;anymore.&lt;/p&gt;&#xA;&lt;p&gt;Some other options I adopted from this post:&lt;/p&gt;&#xA;&lt;div class=&#34;code-block&#34; data-lang=&#34;bash&#34;&gt;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;c1&#34;&gt;# sort branches by last committed date&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 config --global branch.sort -committerdate &#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;c1&#34;&gt;# sort tags by tag-number not alphabetically&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 config --global tag.sort version:refname   &#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;c1&#34;&gt;# better diff algorithm than the default myers&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 config --global diff.algorithm histogram&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;c1&#34;&gt;# color moved code differently than added code in diffs&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 config --global diff.colorMoved plain&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;c1&#34;&gt;# push branch to same-named remote&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 config --global push.default simple&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;c1&#34;&gt;# attempt to autocorrect misspelled git commands in the cli&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 config --global help.autocorrect prompt &#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;c1&#34;&gt;# add the diff to the commit message draft&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 config --global commit.verbose &lt;span class=&#34;nb&#34;&gt;true&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;c1&#34;&gt;# 3-way-diffing&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 config --global merge.conflictstyle zdiff3 &lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&#xA;</description>
    </item>
    
  </channel>
</rss>
