fix echo command and note new config option

This commit is contained in:
Ben Harris 2021-03-18 12:29:56 -04:00
parent c09af523d4
commit b0edea7079
2 changed files with 29 additions and 15 deletions

View File

@ -28,26 +28,28 @@
<h3><a class="ablack" href="default-branch-name.html">
default branch name
</a></h3>
<!-- bashblog_timestamp: #202006161518.54# -->
<div class="subtitle">June 16, 2020 &mdash;
<!-- bashblog_timestamp: #202101101526.29# -->
<div class="subtitle">January 10, 2021 &mdash;
~ben
</div>
<!-- text begin -->
<p>changing git's default branch name has come up recently as an easy action
<p>changing git&rsquo;s default branch name has come up recently as an easy action
we can take to update our language and remove harmful ideas from our daily
usage.</p>
<p>i'm concerned that this effort to change the language used is ultimately a
symbolic gesture to avoid scrutiny into actual change (notably github's
<p>i&rsquo;m concerned that this effort to change the language used is ultimately a
symbolic gesture to avoid scrutiny into actual change (notably github&rsquo;s
push for this change and continued contracts with ICE).</p>
<p>however, it's an easy change to make.</p>
<p>however, it&rsquo;s an easy change to make.</p>
<p>let's have a look at how to change it for new repos:</p>
<hr />
<p>let&rsquo;s have a look at how to change it for new repos:</p>
<pre><code>mkdir -p ~/.config/git/template
echo "ref: refs/head/main" ~/.config/git/template/HEAD
echo "ref: refs/head/main" &gt; ~/.config/git/template/HEAD
git config --global init.templateDir ~/.config/git/template
</code></pre>
@ -60,7 +62,7 @@ package updates.</p>
<pre><code>echo "ref: refs/head/main" | sudo tee /usr/share/git-core/templates/HEAD
</code></pre>
<p>the next time you <code>git init</code>, you'll be on a branch named main.</p>
<p>the next time you <code>git init</code>, you&rsquo;ll be on a branch named main.</p>
<p>to change an existing repo, you can use the <code>-m</code> switch of <code>git-branch</code>:</p>
@ -71,13 +73,18 @@ git branch -m master main
<p>push with <code>-u</code> to your remote if needed and update the default branch in the
repo settings in the hosting platform of choice.</p>
<p>it's a relatively easy change, but don't kid yourself that it makes any real
impact. go protest, <a href="
https://blacklivesmatter.carrd.co/">donate and sign petitions</a>, and get out there to fix the actual problems.</p>
<p>it&rsquo;s a relatively easy change, but don&rsquo;t kid yourself that it makes any real
impact. go protest, <a href="https://blacklivesmatter.carrd.co/">donate and sign petitions</a>, and get out there to fix the actual problems.</p>
<h2>update:</h2>
<p>as of git 2.28, there&rsquo;s a new configuration option and you don&rsquo;t need to use
the templateDir option:</p>
<pre><code>git config --global init.defaultBranch main
</code></pre>
<p>tags: <a href='tag_git.html'>git</a>, <a href='tag_linux.html'>linux</a>, <a href='tag_dev.html'>dev</a></p>
<!-- text end -->
<!-- entry end -->
</div>

View File

@ -15,7 +15,7 @@ however, it's an easy change to make.
let's have a look at how to change it for new repos:
mkdir -p ~/.config/git/template
echo "ref: refs/head/main" ~/.config/git/template/HEAD
echo "ref: refs/head/main" > ~/.config/git/template/HEAD
git config --global init.templateDir ~/.config/git/template
note that you can put this template dir anywhere you like.
@ -40,4 +40,11 @@ it's a relatively easy change, but don't kid yourself that it makes any real
impact. go protest, [donate and sign petitions](
https://blacklivesmatter.carrd.co/), and get out there to fix the actual problems.
## update:
as of git 2.28, there's a new configuration option and you don't need to use
the templateDir option:
git config --global init.defaultBranch main
tags: git, linux, dev