practicalli / blog-cryogen

Cryogen powered blog with all the content used to generate the static website.
https://practical.li/blog-cryogen/
3 stars 2 forks source link

Set git init default branch #91

Open practicalli-johnny opened 4 years ago

practicalli-johnny commented 4 years ago

https://superuser.com/a/1559582/155832

Live is useful if the branch represents code deployed to live systems. The name also matched the typical development workflow cycle.

Alternatively prime, default or main could be used at a better alternative than master

practicalli-johnny commented 4 years ago

Using a template to define the git branch name when running git init The branch is only created once the first commit has been completed.

Open the configuration file for git, usually ~/.gitconfig or ~/.config/git/config.

Add an init section and define a directory that contains all the template files. The template directory does not exist by default, so create the template directory in a meaningful location.

[init]
    templateDir = ~/.config/git/template/

Create the ~/.config/git/template directory if it does not already exist Create a file called HEAD for the template used by git init. Add the ref name to use for the branch and add a new line after

ref: refs/heads/live

Run git init and the contents of the templateDir is copied into .git.

You can now run git init and you will have the branch live