From 8747ebb7cde9e90d20794c06e6806f75cd540142 Mon Sep 17 00:00:00 2001 From: Don Goodman-Wilson Date: Wed, 24 Jun 2020 14:46:33 +0000 Subject: init: allow setting the default for the initial branch name via the config We just introduced the command-line option `--initial-branch=` to allow initializing a new repository with a different initial branch than the hard-coded one. To allow users to override the initial branch name more permanently (i.e. without having to specify the name manually for each and every `git init` invocation), let's introduce the `init.defaultBranch` config setting. Helped-by: Johannes Schindelin Helped-by: Derrick Stolee Signed-off-by: Don Goodman-Wilson Signed-off-by: Junio C Hamano --- Documentation/config/init.txt | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'Documentation/config') diff --git a/Documentation/config/init.txt b/Documentation/config/init.txt index 46fa8c6a08..6ae4a38416 100644 --- a/Documentation/config/init.txt +++ b/Documentation/config/init.txt @@ -1,3 +1,7 @@ init.templateDir:: Specify the directory from which templates will be copied. (See the "TEMPLATE DIRECTORY" section of linkgit:git-init[1].) + +init.defaultBranch:: + Allows overriding the default branch name when initializing + a new repository. -- cgit v1.2.3 From 0cc1b475bbcc530c5429c741fbcfdc2730d27223 Mon Sep 17 00:00:00 2001 From: Johannes Schindelin Date: Wed, 24 Jun 2020 14:46:34 +0000 Subject: clone: use configured default branch name when appropriate When cloning a repository without any branches, Git chooses a default branch name for the as-yet unborn branch. As part of the implicit initialization of the local repository, Git just learned to respect `init.defaultBranch` to choose a different initial branch name. We now really want that branch name to be used as a fall-back. Signed-off-by: Johannes Schindelin Signed-off-by: Junio C Hamano --- Documentation/config/init.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'Documentation/config') diff --git a/Documentation/config/init.txt b/Documentation/config/init.txt index 6ae4a38416..dc77f8c844 100644 --- a/Documentation/config/init.txt +++ b/Documentation/config/init.txt @@ -3,5 +3,5 @@ init.templateDir:: (See the "TEMPLATE DIRECTORY" section of linkgit:git-init[1].) init.defaultBranch:: - Allows overriding the default branch name when initializing - a new repository. + Allows overriding the default branch name e.g. when initializing + a new repository or when cloning an empty repository. -- cgit v1.2.3