blog // ~ben

a blog about tildes and other things

default branch name

June 16, 2020 — ~ben

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.

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).

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
git config --global init.templateDir ~/.config/git/template

note that you can put this template dir anywhere you like.

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.

echo "ref: refs/head/main" | sudo tee /usr/share/git-core/templates/HEAD

the next time you git init, you'll be on a branch named main.

to change an existing repo, you can use the -m switch of git-branch:

git checkout master
git branch -m master main

push with -u to your remote if needed and update the default branch in the repo settings in the hosting platform of choice.

it's a relatively easy change, but don't kid yourself that it makes any real impact. go protest, donate and sign petitions, and get out there to fix the actual problems.

tags: git, linux, dev

dotfiles

July 22, 2018 — ~ben

finally got around to updating my dotfiles to use gnu stow. i adapted ~tomasino's makefile for use with the configs that i'm keeping with it.

now i just need to figure out why my ssh config doesn't copy/symlink my config to ~/.ssh when it already exists.

tags: linux, dotfiles, git

git remotes with ssh aliases

January 12, 2018 — ben

did you know that ~/.ssh/config aliases work for git remotes??

~/.ssh/config

Host gh
HostName github.com
User git
IdentityFile ~/.ssh/gh_key

you can now use gh:username/repo as the remote in place of git@github.com:username/repo, which is much shorter and easier to type many times!

git clone gh:benharri/learngit

there are many other use cases for the ssh_config file. for example, here is my config for the tilde machine for easy ssh connections.

Host tilde
HostName tilde.team
User ben

then use ssh tilde to start a new ssh session. this also works with scp: try something like this scp file.txt tilde:workspace/. in place of scp file.txt ben@tilde.team:workspace/.

the ssh_config file is super useful. check man ssh_config for a full list of options!

tags: git, ssh