init: allow specifying the initial branch name for the new repository
There is a growing number of projects and companies desiring to change the main branch name of their repositories (see e.g. https://twitter.com/mislav/status/1270388510684598272 for background on this). To change that branch name for new repositories, currently the only way to do that automatically is by copying all of Git's template directory, then hard-coding the desired default branch name into the `.git/HEAD` file, and then configuring `init.templateDir` to point to those copied template files. To make this process much less cumbersome, let's introduce a new option: `--initial-branch=<branch-name>`. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:

committed by
Junio C Hamano

parent
6069eccdc9
commit
32ba12dab2
@ -11,6 +11,7 @@ SYNOPSIS
|
||||
[verse]
|
||||
'git init' [-q | --quiet] [--bare] [--template=<template_directory>]
|
||||
[--separate-git-dir <git dir>] [--object-format=<format>]
|
||||
[-b <branch-name> | --initial-branch=<branch-name>]
|
||||
[--shared[=<permissions>]] [directory]
|
||||
|
||||
|
||||
@ -67,6 +68,12 @@ repository.
|
||||
+
|
||||
If this is reinitialization, the repository will be moved to the specified path.
|
||||
|
||||
-b <branch-name::
|
||||
--initial-branch=<branch-name>::
|
||||
|
||||
Use the specified name for the initial branch in the newly created repository.
|
||||
If not specified, fall back to the default name: `master`.
|
||||
|
||||
--shared[=(false|true|umask|group|all|world|everybody|0xxx)]::
|
||||
|
||||
Specify that the Git repository is to be shared amongst several users. This
|
||||
|
Reference in New Issue
Block a user