tilde/blog/tag_git.html

189 lines
5.5 KiB
HTML

<!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="x-ua-compatible" content="ie=edge">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<meta name="theme-color" content="#00cc00">
<link rel="icon" type="image/png" sizes="192x192" href="https://tilde.team/apple-touch-icon-precomposed.png">
<link rel="icon" type="image/png" sizes="96x96" href="https://tilde.team/favicon-96x96.png">
<link rel="stylesheet" href="https://tilde.team/~ben/gruvbox/gruvbox.css">
<link rel="stylesheet" href="extra.css">
<link rel="alternate" type="application/rss+xml" title="subscribe to this page..." href="feed.rss" />
<title>blog // ~ben &mdash; posts tagged "git"</title>
</head><body>
<main>
<div id="divbodyholder">
<div class="headerholder"><div class="header">
<div id="title">
<h1 class="nomargin"><a class="ablack" href="https://tilde.team/~ben/blog/index.html">blog // ~ben</a></h1>
<div id="description">a blog about tildes and other things</div>
</div></div></div>
<div id="divbody"><div class="content">
<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;
~ben
</div>
<!-- text begin -->
<p>changing git'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
push for this change and continued contracts with ICE).</p>
<p>however, it's an easy change to make.</p>
<p>let'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
git config --global init.templateDir ~/.config/git/template
</code></pre>
<p>note that you can put this template dir anywhere you like.</p>
<p>you can also set this system-wide (not just for your user)
in /usr/share, but note that this might get overriden by
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>to change an existing repo, you can use the <code>-m</code> switch of <code>git-branch</code>:</p>
<pre><code>git checkout master
git branch -m master main
</code></pre>
<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>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 -->
<h3><a class="ablack" href="dotfiles.html">
dotfiles
</a></h3>
<!-- bashblog_timestamp: #201807221926.26# -->
<div class="subtitle">July 22, 2018 &mdash;
~ben
</div>
<!-- text begin -->
<p>finally got around to updating my <a href="https://git.tilde.team/ben/dotfiles">dotfiles</a> to use gnu stow.
i adapted <a href="https://github.com/jamestomasino/dotfiles/blob/master/Makefile">~tomasino's makefile</a>
for use with the configs that i'm keeping with it.</p>
<p>now i just need to figure out why my ssh config doesn't copy/symlink my config to ~/.ssh when it
already exists.</p>
<p>tags: <a href='tag_linux.html'>linux</a>, <a href='tag_dotfiles.html'>dotfiles</a>, <a href='tag_git.html'>git</a></p>
<!-- text end -->
<h3><a class="ablack" href="git-remotes-with-ssh-aliases.html">
git remotes with ssh aliases
</a></h3>
<!-- bashblog_timestamp: #201801121330.26# -->
<div class="subtitle">January 12, 2018 &mdash;
ben
</div>
<!-- text begin -->
<p>did you know that <code>~/.ssh/config</code> aliases work for git remotes??</p>
<p>~/.ssh/config</p>
<pre>
Host gh
HostName github.com
User git
IdentityFile ~/.ssh/gh_key
</pre>
<p>you can now use <code>gh:username/repo</code> as the remote in place of <code>git@github.com:username/repo</code>, which is much shorter and easier to type many times!</p>
<p><code>git clone gh:benharri/learngit</code></p>
<p>there are many other use cases for the <code>ssh_config</code> file. for example, here is my config for the tilde machine for easy ssh connections.</p>
<pre>
Host tilde
HostName tilde.team
User ben
</pre>
<p>then use <code>ssh tilde</code> to start a new ssh session. this also works with <code>scp</code>: try something like this <code>scp file.txt tilde:workspace/.</code> in place of <code>scp file.txt ben@tilde.team:workspace/.</code></p>
<p>the ssh_config file is super useful. check <code>man ssh_config</code> for a full list of options!</p>
<p>tags: <a href='tag_git.html'>git</a>, <a href='tag_ssh.html'>ssh</a></p>
<!-- text end -->
</div>
<div id="footer">CC by-nc-nd <a href="https://tilde.team/~ben/">~ben</a> &mdash; <a href="mailto:ben&#64;tilde&#46;team">ben&#64;tilde&#46;team</a><br>
generated with <a href="https://tildegit.org/team/bashblog">bashblog</a>, a single bash script to easily create blogs like this one</div>
</div></div>
<script src="https://utteranc.es/client.js"
repo="benharri/tilde"
issue-term="title"
crossorigin="anonymous"
theme="github-dark"
async>
</script>
</main>
<br>
</body></html>