Tweet
the most annoying thing about the industry-wide master -> main git branch renaming of 2021 is the complete inconsistency of it. (this is a technical post, not politics) any repo that was hard to do because of ci/releases/hardcoded integrations was delayed until later (and eventually deprioritized). if you work with a lot of different repos at your job, you're going to get annoyed pretty quickly. anyway, here are two aliases I have: the one that's always correct, but slow: git checkout "$(git remote show origin | sed -n '/HEAD branch/s/.*: //p')" the one that's fast and works 99.999% of the time: git checkout main 2>/dev/null || git checkout master alias them to `gcom` or something now anytime you type gcom it tries to switch to main and if it doesn't exist, it switches to master