Welcome to my personal scratchpad

Delete Git branch locally and remotely

  1. git branch -d <branch_name>
  2. git push -d <remote_name> <branch_name>

Change default git branch from master to main

I read about GitHub renaming the default branch to something less offending to a lot of people. Sounds like a no-brainer, som I decided to switch. My approach will be to simply create a new branch called main and mark it as default in GitLab. I won't go through all my repositoies at once, but instead make the switch when I'm actively working on something.

My understanding is that the concept of a default branch is not a Git thing, but rather a Git Repository Thing. So this should be enough to make the switch:

  1. git checkout -b main
  2. git push --set-upstream origin main
  3. gitlab.com → Repository settings → Default Branch
  4. gitlab.com → Repository settings → Protected Branches