Suppose you want the default branch name created by git init (or tools that shell out to it, like cargo new) to be something other than master. In this example, I'll call it develop.
-
Add the following to your
.gitconfig:[init] templateDir = ~/.config/git/template/This tells
git initto use the files found in~/.config/git/templateto populate the initial.gitdirectory. You can use whatever path you'd like. -
Create a file in the template directory called
HEAD, for example~/.config/git/template/HEAD, with the following contents:ref: refs/heads/developReplace
developwith the default name of your choice.
Thanks!
I've added this function in my
.zsrhcto rename the active project I'm on.