A directory of brand guidelines: logosearch.link

The main branch

Dom Habersack
Dom HabersackOctober 28, 2020
A circus sign saying “original”.
It never mattered what we call the original branch.

Hey friends! As I am deep in business and financial planning, I missed that GitHub’s renaming efforts are now in place. If you, like me, are looking for a quick code-related distraction, this tip is for you.

GitHub now initializes new repositories with a branch called “main” instead of “master”. Existing repositories remain as they are. We can update old repositories to this naming to make working on many projects at once easier.

The name of the default branch was always arbitrary. There was never a technical need to give this branch a specific name. Everybody agreed on the name “master” based on a now outdated convention.

With this move by GitHub, it’s likely that soon everybody else will follow. Let’s train ourselves to type “git checkout main” now to be ready for this change.

Existing projects can move to a main branch in five steps:

  1. Move the master branch to one called main with git branch -m master main. This moves the entire history of the branch over as well.
  2. Push the new branch to GitHub with git push -u origin main.
  3. Point your HEAD to the new branch with git remote set-head origin main.
  4. Go to your repository’s settings on GitHub and change what it considers the “default branch”.
  5. Delete the remote master branch with git push origin --delete master.

After renaming the branch, you’ll have to update all places you hardcoded it in. Check and update your aliases, deployment scripts, and CI pipelines. If you never set a particular name in those, you’re fine. When working in a team, make sure everybody else updates their references as well.

All in all, you can complete this process in a few minutes per project.

– Dom

Continue reading

A construction site warning sign telling people not to get closer.
#55September 23, 2020

The global .gitignore

Instead of ignoring the same files specific to your machine in every project, exclude them globally once for all your projects.

An empty logbook
#64November 25, 2020

Get more value from your git log

We can customize the look of our git log to get more value out of fewer lines. In this issue, I walk you through how we can build a prettier log step by step.

A mechanical keyboard using the US keyboard layout.
#23February 12, 2020

A better keyboard layout for programming

The US keyboard layout puts many of the symbols we need a lot when coding on their own dedicated keys.

Read all issues →