]> git.99rst.org Git - git.git/commit
var: add GIT_DEFAULT_BRANCH variable
authorThomas Weißschuh <redacted>
Wed, 3 Nov 2021 20:17:02 +0000 (21:17 +0100)
committerJunio C Hamano <redacted>
Wed, 3 Nov 2021 20:25:36 +0000 (13:25 -0700)
commite06c9e1df28e04bbf013840c6c50ce1be41b9583
tree0e2c67584cfba601c6d29a4c6981711dba173626
parentaf6d1d602a8f64164b266364339c4e936d5bbc33
var: add GIT_DEFAULT_BRANCH variable

Introduce the logical variable GIT_DEFAULT_BRANCH which represents the
the default branch name that will be used by "git init".

Currently this variable is equivalent to
    git config init.defaultbranch || 'master'

This however will break if at one point the default branch is changed as
indicated by `default_branch_name_advice` in `refs.c`.

By providing this command ahead of time users of git can make their
code forward-compatible.

Helped-by: Johannes Schindelin <redacted>
Helped-by: Eric Sunshine <redacted>
Helped-by: Ævar Arnfjörð Bjarmason <redacted>
Signed-off-by: Thomas Weißschuh <redacted>
Signed-off-by: Junio C Hamano <redacted>
Documentation/git-var.txt
builtin/var.c
t/t0007-git-var.sh
git clone https://git.99rst.org/PROJECT