Merge branch 'pw/3.0-default-initial-branch-to-main'

Declare that "git init" that is not otherwise configured uses
'main' as the initial branch, not 'master', starting Git 3.0.

* pw/3.0-default-initial-branch-to-main:
  t0613: stop setting default initial branch
  t9902: switch default branch name to main
  t4013: switch default branch name to main
  breaking-changes: switch default branch to main
main
Junio C Hamano 2025-09-29 11:40:33 -07:00
commit e50c3ca095
107 changed files with 283 additions and 240 deletions

View File

@ -165,6 +165,12 @@ A prerequisite for this change is that the ecosystem is ready to support the
"reftable" format. Most importantly, alternative implementations of Git like
JGit, libgit2 and Gitoxide need to support it.

* In new repositories, the default branch name will be `main`. We have been
warning that the default name will change since 675704c74dd (init:
provide useful advice about init.defaultBranch, 2020-12-11). The new name
matches the default branch name used in new repositories by many of the
big Git forges.

=== Removals

* Support for grafting commits has long been superseded by git-replace(1).

View File

@ -77,9 +77,15 @@ If this is a reinitialization, the repository will be moved to the specified pat
`-b <branch-name>`::
`--initial-branch=<branch-name>`::
Use _<branch-name>_ for the initial branch in the newly created
repository. If not specified, fall back to the default name (currently
`master`, but this is subject to change in the future; the name can be
customized via the `init.defaultBranch` configuration variable).
repository. If not specified, fall back to the default name
ifndef::with-breaking-changes[]
(currently `master`, but this will change to `main` when Git 3.0 is released).
endif::with-breaking-changes[]
ifdef::with-breaking-changes[]
`main`.
endif::with-breaking-changes[]
The default name can be customized via the `init.defaultBranch` configuration
variable.

`--shared[=(false|true|umask|group|all|world|everybody|<perm>)]`::


View File

@ -51,7 +51,9 @@ static struct {
[ADVICE_AM_WORK_DIR] = { "amWorkDir" },
[ADVICE_CHECKOUT_AMBIGUOUS_REMOTE_BRANCH_NAME] = { "checkoutAmbiguousRemoteBranchName" },
[ADVICE_COMMIT_BEFORE_MERGE] = { "commitBeforeMerge" },
#ifndef WITH_BREAKING_CHANGES
[ADVICE_DEFAULT_BRANCH_NAME] = { "defaultBranchName" },
#endif /* WITH_BREAKING_CHANGES */
[ADVICE_DETACHED_HEAD] = { "detachedHead" },
[ADVICE_DIVERGING] = { "diverging" },
[ADVICE_FETCH_SET_HEAD_WARN] = { "fetchRemoteHEADWarn" },

View File

@ -18,7 +18,9 @@ enum advice_type {
ADVICE_AM_WORK_DIR,
ADVICE_CHECKOUT_AMBIGUOUS_REMOTE_BRANCH_NAME,
ADVICE_COMMIT_BEFORE_MERGE,
#ifndef WITH_BREAKING_CHANGES
ADVICE_DEFAULT_BRANCH_NAME,
#endif /* WITH_BREAKING_CHANGES */
ADVICE_DETACHED_HEAD,
ADVICE_DIVERGING,
ADVICE_FETCH_SET_HEAD_WARN,

View File

@ -9,7 +9,6 @@ run_tests=t

case "$jobname" in
linux-breaking-changes)
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
export WITH_BREAKING_CHANGES=YesPlease
;;
linux-TEST-vars)

15
refs.c
View File

@ -627,10 +627,12 @@ void expand_ref_prefix(struct strvec *prefixes, const char *prefix)
strvec_pushf(prefixes, *p, len, prefix);
}

#ifndef WITH_BREAKING_CHANGES
static const char default_branch_name_advice[] = N_(
"Using '%s' as the name for the initial branch. This default branch name\n"
"is subject to change. To configure the initial branch name to use in all\n"
"of your new repositories, which will suppress this warning, call:\n"
"will change to \"main\" in Git 3.0. To configure the initial branch name\n"
"to use in all of your new repositories, which will suppress this warning,\n"
"call:\n"
"\n"
"\tgit config --global init.defaultBranch <name>\n"
"\n"
@ -639,8 +641,9 @@ static const char default_branch_name_advice[] = N_(
"\n"
"\tgit branch -m <name>\n"
);
#endif /* WITH_BREAKING_CHANGES */

char *repo_default_branch_name(struct repository *r, int quiet)
char *repo_default_branch_name(struct repository *r, MAYBE_UNUSED int quiet)
{
const char *config_key = "init.defaultbranch";
const char *config_display_key = "init.defaultBranch";
@ -649,14 +652,18 @@ char *repo_default_branch_name(struct repository *r, int quiet)

if (env && *env)
ret = xstrdup(env);
else if (repo_config_get_string(r, config_key, &ret) < 0)
if (!ret && repo_config_get_string(r, config_key, &ret) < 0)
die(_("could not retrieve `%s`"), config_display_key);

if (!ret) {
#ifdef WITH_BREAKING_CHANGES
ret = xstrdup("main");
#else
ret = xstrdup("master");
if (!quiet)
advise_if_enabled(ADVICE_DEFAULT_BRANCH_NAME,
_(default_branch_name_advice), ret);
#endif /* WITH_BREAKING_CHANGES */
}

full_ref = xstrfmt("refs/heads/%s", ret);

View File

@ -868,7 +868,7 @@ test_expect_success 'overridden default initial branch name (config)' '
grep nmb actual
'

test_expect_success 'advice on unconfigured init.defaultBranch' '
test_expect_success !WITH_BREAKING_CHANGES 'advice on unconfigured init.defaultBranch' '
GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME= git -c color.advice=always \
init unconfigured-default-branch-name 2>err &&
test_decode_color <err >decoded &&
@ -883,6 +883,22 @@ test_expect_success 'advice on unconfigured init.defaultBranch disabled' '
test_grep ! "hint: " err
'

test_expect_success 'default branch name' '
if test_have_prereq WITH_BREAKING_CHANGES
then
expect=main
else
expect=master
fi &&
echo "refs/heads/$expect" >expect &&
(
sane_unset GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME &&
git init default-initial-branch-name
) &&
git -C default-initial-branch-name symbolic-ref HEAD >actual &&
test_cmp expect actual
'

test_expect_success 'overridden default main branch name (env)' '
test_config_global init.defaultBranch nmb &&
GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=env git init main-branch-env &&

View File

@ -11,16 +11,18 @@ export GIT_TEST_REFTABLE_AUTOCOMPACTION
# Block sizes depend on the hash function, so we force SHA1 here.
GIT_TEST_DEFAULT_HASH=sha1
export GIT_TEST_DEFAULT_HASH
# Block sizes also depend on the actual refs we write, so we force "master" to
# be the default initial branch name.
GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=master
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME

. ./test-lib.sh

# Block sizes depend on the actual refs we write, so, for tests
# that check block size, we force the initial branch name to be "master".
init_repo () {
git init --initial-branch master repo
}

test_expect_success 'default write options' '
test_when_finished "rm -rf repo" &&
git init repo &&
init_repo &&
(
cd repo &&
test_commit initial &&
@ -43,7 +45,7 @@ test_expect_success 'default write options' '
test_expect_success 'disabled reflog writes no log blocks' '
test_config_global core.logAllRefUpdates false &&
test_when_finished "rm -rf repo" &&
git init repo &&
init_repo &&
(
cd repo &&
test_commit initial &&
@ -62,7 +64,7 @@ test_expect_success 'disabled reflog writes no log blocks' '

test_expect_success 'many refs results in multiple blocks' '
test_when_finished "rm -rf repo" &&
git init repo &&
init_repo &&
(
cd repo &&
test_commit initial &&
@ -115,7 +117,7 @@ test_expect_success 'tiny block size leads to error' '
test_expect_success 'small block size leads to multiple ref blocks' '
test_config_global core.logAllRefUpdates false &&
test_when_finished "rm -rf repo" &&
git init repo &&
init_repo &&
(
cd repo &&
test_commit A &&
@ -172,7 +174,7 @@ test_expect_success 'block size exceeding maximum supported size' '

test_expect_success 'restart interval at every single record' '
test_when_finished "rm -rf repo" &&
git init repo &&
init_repo &&
(
cd repo &&
test_commit initial &&
@ -212,7 +214,7 @@ test_expect_success 'restart interval exceeding maximum supported interval' '
test_expect_success 'object index gets written by default with ref index' '
test_config_global core.logAllRefUpdates false &&
test_when_finished "rm -rf repo" &&
git init repo &&
init_repo &&
(
cd repo &&
test_commit initial &&
@ -247,7 +249,7 @@ test_expect_success 'object index gets written by default with ref index' '
test_expect_success 'object index can be disabled' '
test_config_global core.logAllRefUpdates false &&
test_when_finished "rm -rf repo" &&
git init repo &&
init_repo &&
(
cd repo &&
test_commit initial &&

View File

@ -5,7 +5,7 @@

test_description='Various diff formatting options'

GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=master
GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME

. ./test-lib.sh
@ -70,7 +70,7 @@ test_expect_success setup '
GIT_COMMITTER_DATE="2006-06-26 00:04:00 +0000" &&
export GIT_AUTHOR_DATE GIT_COMMITTER_DATE &&

git checkout master &&
git checkout main &&
git pull -s ours --no-rebase . side &&

GIT_AUTHOR_DATE="2006-06-26 00:05:00 +0000" &&
@ -95,7 +95,7 @@ test_expect_success setup '
test_write_lines B A >dir/sub &&
git add dir/sub &&
git commit -m "Rearranged lines in dir/sub" &&
git checkout master &&
git checkout main &&

GIT_AUTHOR_DATE="2006-06-26 00:06:00 +0000" &&
GIT_COMMITTER_DATE="2006-06-26 00:06:00 +0000" &&
@ -103,7 +103,7 @@ test_expect_success setup '
git checkout -b mode initial &&
git update-index --chmod=+x file0 &&
git commit -m "update mode" &&
git checkout -f master &&
git checkout -f main &&

GIT_AUTHOR_DATE="2006-06-26 00:06:00 +0000" &&
GIT_COMMITTER_DATE="2006-06-26 00:06:00 +0000" &&
@ -112,12 +112,12 @@ test_expect_success setup '
git update-index --chmod=+x file2 &&
git commit -m "update mode (file2)" &&
git notes add -m "note" &&
git checkout -f master &&
git checkout -f main &&

# Same merge as master, but with parents reversed. Hide it in a
# Same merge as main, but with parents reversed. Hide it in a
# pseudo-ref to avoid impacting tests with --all.
commit=$(echo reverse |
git commit-tree -p master^2 -p master^1 master^{tree}) &&
git commit-tree -p main^2 -p main^1 main^{tree}) &&
git update-ref REVERSE $commit &&

git config diff.renames false &&
@ -127,15 +127,15 @@ test_expect_success setup '

: <<\EOF
! [initial] Initial
* [master] Merge branch 'side'
* [main] Merge branch 'side'
! [rearrange] Rearranged lines in dir/sub
! [side] Side
----
+ [rearrange] Rearranged lines in dir/sub
- [master] Merge branch 'side'
- [main] Merge branch 'side'
* + [side] Side
* [master^] Third
* [master~2] Second
* [main^] Third
* [main~2] Second
+*++ [initial] Initial
EOF

@ -311,64 +311,64 @@ diff-tree initial mode
diff-tree --stat initial mode
diff-tree --summary initial mode

diff-tree master
diff-tree -m master
diff-tree -p master
diff-tree -p -m master
diff-tree -c master
diff-tree -c --abbrev master
:noellipses diff-tree -c --abbrev master
diff-tree --cc master
diff-tree main
diff-tree -m main
diff-tree -p main
diff-tree -p -m main
diff-tree -c main
diff-tree -c --abbrev main
:noellipses diff-tree -c --abbrev main
diff-tree --cc main
# stat only should show the diffstat with the first parent
diff-tree -c --stat master
diff-tree --cc --stat master
diff-tree -c --stat --summary master
diff-tree --cc --stat --summary master
diff-tree -c --stat main
diff-tree --cc --stat main
diff-tree -c --stat --summary main
diff-tree --cc --stat --summary main
# stat summary should show the diffstat and summary with the first parent
diff-tree -c --stat --summary side
diff-tree --cc --stat --summary side
diff-tree --cc --shortstat master
diff-tree --cc --shortstat main
diff-tree --cc --summary REVERSE
# improved by Timo's patch
diff-tree --cc --patch-with-stat master
diff-tree --cc --patch-with-stat main
# improved by Timo's patch
diff-tree --cc --patch-with-stat --summary master
diff-tree --cc --patch-with-stat --summary main
# this is correct
diff-tree --cc --patch-with-stat --summary side

log master
log -p master
log --root master
log --root -p master
log --patch-with-stat master
log --root --patch-with-stat master
log --root --patch-with-stat --summary master
log main
log -p main
log --root main
log --root -p main
log --patch-with-stat main
log --root --patch-with-stat main
log --root --patch-with-stat --summary main
# improved by Timo's patch
log --root -c --patch-with-stat --summary master
log --root -c --patch-with-stat --summary main
# improved by Timo's patch
log --root --cc --patch-with-stat --summary master
log --no-diff-merges -p --first-parent master
log --diff-merges=off -p --first-parent master
log --first-parent --diff-merges=off -p master
log -p --first-parent master
log -p --diff-merges=first-parent master
log --diff-merges=first-parent master
log -m -p --first-parent master
log -m -p master
log --cc -m -p master
log -c -m -p master
log -m --raw master
log -m --stat master
log -SF master
log -S F master
log -SF -p master
log -SF master --max-count=0
log -SF master --max-count=1
log -SF master --max-count=2
log -GF master
log -GF -p master
log -GF -p --pickaxe-all master
log -IA -IB -I1 -I2 -p master
log --root --cc --patch-with-stat --summary main
log --no-diff-merges -p --first-parent main
log --diff-merges=off -p --first-parent main
log --first-parent --diff-merges=off -p main
log -p --first-parent main
log -p --diff-merges=first-parent main
log --diff-merges=first-parent main
log -m -p --first-parent main
log -m -p main
log --cc -m -p main
log -c -m -p main
log -m --raw main
log -m --stat main
log -SF main
log -S F main
log -SF -p main
log -SF main --max-count=0
log -SF main --max-count=1
log -SF main --max-count=2
log -GF main
log -GF -p main
log -GF -p --pickaxe-all main
log -IA -IB -I1 -I2 -p main
log --decorate --all
log --decorate=full --all
log --decorate --clear-decorations --all
@ -377,35 +377,35 @@ log --decorate=full --clear-decorations --all
rev-list --parents HEAD
rev-list --children HEAD

whatchanged master
:noellipses whatchanged master
whatchanged -p master
whatchanged --root master
:noellipses whatchanged --root master
whatchanged --root -p master
whatchanged --patch-with-stat master
whatchanged --root --patch-with-stat master
whatchanged --root --patch-with-stat --summary master
whatchanged main
:noellipses whatchanged main
whatchanged -p main
whatchanged --root main
:noellipses whatchanged --root main
whatchanged --root -p main
whatchanged --patch-with-stat main
whatchanged --root --patch-with-stat main
whatchanged --root --patch-with-stat --summary main
# improved by Timo's patch
whatchanged --root -c --patch-with-stat --summary master
whatchanged --root -c --patch-with-stat --summary main
# improved by Timo's patch
whatchanged --root --cc --patch-with-stat --summary master
whatchanged -SF master
:noellipses whatchanged -SF master
whatchanged -SF -p master
whatchanged --root --cc --patch-with-stat --summary main
whatchanged -SF main
:noellipses whatchanged -SF main
whatchanged -SF -p main

log --patch-with-stat master -- dir/
whatchanged --patch-with-stat master -- dir/
log --patch-with-stat --summary master -- dir/
whatchanged --patch-with-stat --summary master -- dir/
log --patch-with-stat main -- dir/
whatchanged --patch-with-stat main -- dir/
log --patch-with-stat --summary main -- dir/
whatchanged --patch-with-stat --summary main -- dir/

show initial
show --root initial
show side
show master
show -c master
show -m master
show --first-parent master
show main
show -c main
show -m main
show --first-parent main
show --stat side
show --stat --summary side
show --patch-with-stat side
@ -414,22 +414,22 @@ show --patch-with-raw side
show --patch-with-stat --summary side

format-patch --stdout initial..side
format-patch --stdout initial..master^
format-patch --stdout initial..master
format-patch --stdout --no-numbered initial..master
format-patch --stdout --numbered initial..master
format-patch --stdout initial..main^
format-patch --stdout initial..main
format-patch --stdout --no-numbered initial..main
format-patch --stdout --numbered initial..main
format-patch --attach --stdout initial..side
format-patch --attach --stdout --suffix=.diff initial..side
format-patch --attach --stdout initial..master^
format-patch --attach --stdout initial..master
format-patch --attach --stdout initial..main^
format-patch --attach --stdout initial..main
format-patch --inline --stdout initial..side
format-patch --inline --stdout initial..master^
format-patch --inline --stdout --numbered-files initial..master
format-patch --inline --stdout initial..master
format-patch --inline --stdout --subject-prefix=TESTCASE initial..master
format-patch --inline --stdout initial..main^
format-patch --inline --stdout --numbered-files initial..main
format-patch --inline --stdout initial..main
format-patch --inline --stdout --subject-prefix=TESTCASE initial..main
config format.subjectprefix DIFFERENT_PREFIX
format-patch --inline --stdout initial..master^^
format-patch --stdout --cover-letter -n initial..master^
format-patch --inline --stdout initial..main^^
format-patch --stdout --cover-letter -n initial..main^

diff --abbrev initial..side
diff -U initial..side
@ -448,13 +448,13 @@ diff --name-status dir2 dir
diff --no-index --name-status dir2 dir
diff --no-index --name-status -- dir2 dir
diff --no-index dir dir3
diff master master^ side
diff main main^ side
# Can't use spaces...
diff --line-prefix=abc master master^ side
diff --dirstat master~1 master~2
diff --line-prefix=abc main main^ side
diff --dirstat main~1 main~2
diff --dirstat initial rearrange
diff --dirstat-by-file initial rearrange
diff --dirstat --cc master~1 master
diff --dirstat --cc main~1 main
# No-index --abbrev and --no-abbrev
diff --raw initial
:noellipses diff --raw initial
@ -482,7 +482,7 @@ test_expect_success !WITH_BREAKING_CHANGES 'whatchanged needs --i-still-use-this
'

test_expect_success 'log -m matches pure log' '
git log master >result &&
git log main >result &&
process_diffs result >expected &&
git log -m >result &&
process_diffs result >actual &&
@ -490,17 +490,17 @@ test_expect_success 'log -m matches pure log' '
'

test_expect_success 'log --diff-merges=on matches --diff-merges=separate' '
git log -p --diff-merges=separate master >result &&
git log -p --diff-merges=separate main >result &&
process_diffs result >expected &&
git log -p --diff-merges=on master >result &&
git log -p --diff-merges=on main >result &&
process_diffs result >actual &&
test_cmp expected actual
'

test_expect_success 'log --dd matches --diff-merges=1 -p' '
git log --diff-merges=1 -p master >result &&
git log --diff-merges=1 -p main >result &&
process_diffs result >expected &&
git log --dd master >result &&
git log --dd main >result &&
process_diffs result >actual &&
test_cmp expected actual
'
@ -511,19 +511,19 @@ test_expect_success 'deny wrong log.diffMerges config' '
'

test_expect_success 'git config log.diffMerges first-parent' '
git log -p --diff-merges=first-parent master >result &&
git log -p --diff-merges=first-parent main >result &&
process_diffs result >expected &&
test_config log.diffMerges first-parent &&
git log -p --diff-merges=on master >result &&
git log -p --diff-merges=on main >result &&
process_diffs result >actual &&
test_cmp expected actual
'

test_expect_success 'git config log.diffMerges first-parent vs -m' '
git log -p --diff-merges=first-parent master >result &&
git log -p --diff-merges=first-parent main >result &&
process_diffs result >expected &&
test_config log.diffMerges first-parent &&
git log -p -m master >result &&
git log -p -m main >result &&
process_diffs result >actual &&
test_cmp expected actual
'
@ -572,7 +572,7 @@ test_expect_success 'diff-tree --stdin with log formatting' '
Third
Second
EOF
git rev-list master | git diff-tree --stdin --format=%s -s >actual &&
git rev-list main | git diff-tree --stdin --format=%s -s >actual &&
test_cmp expect actual
'

@ -585,16 +585,16 @@ test_expect_success 'diff-tree --stdin with pathspec' '

dir/sub
EOF
git rev-list master^ |
git rev-list main^ |
git diff-tree -r --stdin --name-only --format=%s dir >actual &&
test_cmp expect actual
'

test_expect_success 'show A B ... -- <pathspec>' '
# side touches dir/sub, file0, and file3
# master^ touches dir/sub, and file1
# master^^ touches dir/sub, file0, and file2
git show --name-only --format="<%s>" side master^ master^^ -- dir >actual &&
# main^ touches dir/sub, and file1
# main^^ touches dir/sub, file0, and file2
git show --name-only --format="<%s>" side main^ main^^ -- dir >actual &&
cat >expect <<-\EOF &&
<Side>

@ -610,7 +610,7 @@ test_expect_success 'show A B ... -- <pathspec>' '
'

test_expect_success 'diff -I<regex>: setup' '
git checkout master &&
git checkout main &&
test_seq 50 >file0 &&
git commit -m "Set up -I<regex> test file" file0 &&
test_seq 50 | sed -e "s/13/ten and three/" -e "/7\$/d" >file0 &&

View File

@ -1,4 +1,4 @@
$ git diff-tree --cc --patch-with-stat --summary master
$ git diff-tree --cc --patch-with-stat --summary main
59d314ad6f356dd08601a4cd5e530381da3e3c64
dir/sub | 2 ++
file0 | 3 +++

View File

@ -1,4 +1,4 @@
$ git diff-tree --cc --patch-with-stat master
$ git diff-tree --cc --patch-with-stat main
59d314ad6f356dd08601a4cd5e530381da3e3c64
dir/sub | 2 ++
file0 | 3 +++

View File

@ -1,4 +1,4 @@
$ git diff-tree --cc --shortstat master
$ git diff-tree --cc --shortstat main
59d314ad6f356dd08601a4cd5e530381da3e3c64
2 files changed, 5 insertions(+)
$

View File

@ -1,4 +1,4 @@
$ git diff-tree -c --stat --summary master
$ git diff-tree --cc --stat --summary main
59d314ad6f356dd08601a4cd5e530381da3e3c64
dir/sub | 2 ++
file0 | 3 +++

View File

@ -1,4 +1,4 @@
$ git diff-tree -c --stat master
$ git diff-tree --cc --stat main
59d314ad6f356dd08601a4cd5e530381da3e3c64
dir/sub | 2 ++
file0 | 3 +++

View File

@ -1,4 +1,4 @@
$ git diff-tree --cc master
$ git diff-tree --cc main
59d314ad6f356dd08601a4cd5e530381da3e3c64
diff --cc dir/sub
index cead32e,7289e35..992913c

View File

@ -1,4 +1,4 @@
$ git diff-tree -c --abbrev master
$ git diff-tree -c --abbrev main
59d314ad6f356dd08601a4cd5e530381da3e3c64
::100644 100644 100644 cead32e... 7289e35... 992913c... MM dir/sub
::100644 100644 100644 b414108... f4615da... 10a8a9f... MM file0

View File

@ -1,4 +1,4 @@
$ git diff-tree --cc --stat --summary master
$ git diff-tree -c --stat --summary main
59d314ad6f356dd08601a4cd5e530381da3e3c64
dir/sub | 2 ++
file0 | 3 +++

View File

@ -1,4 +1,4 @@
$ git diff-tree --cc --stat master
$ git diff-tree -c --stat main
59d314ad6f356dd08601a4cd5e530381da3e3c64
dir/sub | 2 ++
file0 | 3 +++

View File

@ -1,4 +1,4 @@
$ git diff-tree -c master
$ git diff-tree -c main
59d314ad6f356dd08601a4cd5e530381da3e3c64
::100644 100644 100644 cead32e925b1420c84c14cbf7cf755e7e45af8ad 7289e35bff32727c08dda207511bec138fdb9ea5 992913c5aa0a5476d10c49ed0f21fc0c6d1aedf3 MM dir/sub
::100644 100644 100644 b414108e81e5091fe0974a1858b4d0d22b107f70 f4615da674c09df322d6ba8d6b21ecfb1b1ba510 10a8a9f3657f91a156b9f0184ed79a20adef9f7f MM file0

View File

@ -1,4 +1,4 @@
$ git diff-tree -m master
$ git diff-tree -m main
59d314ad6f356dd08601a4cd5e530381da3e3c64
:040000 040000 65f5c9dd60ce3b2b3324b618ac7accf8d912c113 0564e026437809817a64fff393079714b6dd4628 M dir
:100644 100644 b414108e81e5091fe0974a1858b4d0d22b107f70 10a8a9f3657f91a156b9f0184ed79a20adef9f7f M file0

View File

@ -1,4 +1,4 @@
$ git diff-tree -p -m master
$ git diff-tree -p -m main
59d314ad6f356dd08601a4cd5e530381da3e3c64
diff --git a/dir/sub b/dir/sub
index cead32e..992913c 100644

View File

@ -0,0 +1,2 @@
$ git diff-tree -p main
$

View File

@ -1,2 +0,0 @@
$ git diff-tree -p master
$

View File

@ -0,0 +1,2 @@
$ git diff-tree main
$

View File

@ -1,2 +0,0 @@
$ git diff-tree master
$

View File

@ -0,0 +1,3 @@
$ git diff --dirstat --cc main~1 main
40.0% dir/
$

View File

@ -1,3 +0,0 @@
$ git diff --dirstat --cc master~1 master
40.0% dir/
$

View File

@ -0,0 +1,3 @@
$ git diff --dirstat main~1 main~2
40.0% dir/
$

View File

@ -1,3 +0,0 @@
$ git diff --dirstat master~1 master~2
40.0% dir/
$

View File

@ -1,4 +1,4 @@
$ git diff --line-prefix=abc master master^ side
$ git diff --line-prefix=abc main main^ side
abcdiff --cc dir/sub
abcindex cead32e,7289e35..992913c
abc--- a/dir/sub

View File

@ -1,4 +1,4 @@
$ git diff master master^ side
$ git diff main main^ side
diff --cc dir/sub
index cead32e,7289e35..992913c
--- a/dir/sub

View File

@ -1,4 +1,4 @@
$ git format-patch --attach --stdout initial..master
$ git format-patch --attach --stdout initial..main
From 1bde4ae5f36c8d9abe3a0fce0c6aab3c4a12fe44 Mon Sep 17 00:00:00 2001
From: A U Thor <author@example.com>
Date: Mon, 26 Jun 2006 00:01:00 +0000

View File

@ -1,4 +1,4 @@
$ git format-patch --attach --stdout initial..master^
$ git format-patch --attach --stdout initial..main^
From 1bde4ae5f36c8d9abe3a0fce0c6aab3c4a12fe44 Mon Sep 17 00:00:00 2001
From: A U Thor <author@example.com>
Date: Mon, 26 Jun 2006 00:01:00 +0000

View File

@ -1,4 +1,4 @@
$ git format-patch --inline --stdout --numbered-files initial..master
$ git format-patch --inline --stdout --numbered-files initial..main
From 1bde4ae5f36c8d9abe3a0fce0c6aab3c4a12fe44 Mon Sep 17 00:00:00 2001
From: A U Thor <author@example.com>
Date: Mon, 26 Jun 2006 00:01:00 +0000

View File

@ -1,4 +1,4 @@
$ git format-patch --inline --stdout --subject-prefix=TESTCASE initial..master
$ git format-patch --inline --stdout --subject-prefix=TESTCASE initial..main
From 1bde4ae5f36c8d9abe3a0fce0c6aab3c4a12fe44 Mon Sep 17 00:00:00 2001
From: A U Thor <author@example.com>
Date: Mon, 26 Jun 2006 00:01:00 +0000

View File

@ -1,4 +1,4 @@
$ git format-patch --inline --stdout initial..master
$ git format-patch --inline --stdout initial..main
From 1bde4ae5f36c8d9abe3a0fce0c6aab3c4a12fe44 Mon Sep 17 00:00:00 2001
From: A U Thor <author@example.com>
Date: Mon, 26 Jun 2006 00:01:00 +0000

View File

@ -1,4 +1,4 @@
$ git format-patch --inline --stdout initial..master^
$ git format-patch --inline --stdout initial..main^
From 1bde4ae5f36c8d9abe3a0fce0c6aab3c4a12fe44 Mon Sep 17 00:00:00 2001
From: A U Thor <author@example.com>
Date: Mon, 26 Jun 2006 00:01:00 +0000

View File

@ -1,4 +1,4 @@
$ git format-patch --inline --stdout initial..master^^
$ git format-patch --inline --stdout initial..main^^
From 1bde4ae5f36c8d9abe3a0fce0c6aab3c4a12fe44 Mon Sep 17 00:00:00 2001
From: A U Thor <author@example.com>
Date: Mon, 26 Jun 2006 00:01:00 +0000

View File

@ -1,4 +1,4 @@
$ git format-patch --stdout --cover-letter -n initial..master^
$ git format-patch --stdout --cover-letter -n initial..main^
From 9a6d4949b6b76956d9d5e26f2791ec2ceff5fdc0 Mon Sep 17 00:00:00 2001
From: C O Mitter <committer@example.com>
Date: Mon, 26 Jun 2006 00:06:00 +0000

View File

@ -1,4 +1,4 @@
$ git format-patch --stdout --no-numbered initial..master
$ git format-patch --stdout --no-numbered initial..main
From 1bde4ae5f36c8d9abe3a0fce0c6aab3c4a12fe44 Mon Sep 17 00:00:00 2001
From: A U Thor <author@example.com>
Date: Mon, 26 Jun 2006 00:01:00 +0000

View File

@ -1,4 +1,4 @@
$ git format-patch --stdout --numbered initial..master
$ git format-patch --stdout --numbered initial..main
From 1bde4ae5f36c8d9abe3a0fce0c6aab3c4a12fe44 Mon Sep 17 00:00:00 2001
From: A U Thor <author@example.com>
Date: Mon, 26 Jun 2006 00:01:00 +0000

View File

@ -1,4 +1,4 @@
$ git format-patch --stdout initial..master
$ git format-patch --stdout initial..main
From 1bde4ae5f36c8d9abe3a0fce0c6aab3c4a12fe44 Mon Sep 17 00:00:00 2001
From: A U Thor <author@example.com>
Date: Mon, 26 Jun 2006 00:01:00 +0000

View File

@ -1,4 +1,4 @@
$ git format-patch --stdout initial..master^
$ git format-patch --stdout initial..main^
From 1bde4ae5f36c8d9abe3a0fce0c6aab3c4a12fe44 Mon Sep 17 00:00:00 2001
From: A U Thor <author@example.com>
Date: Mon, 26 Jun 2006 00:01:00 +0000

View File

@ -1,4 +1,4 @@
$ git log -c -m -p master
$ git log --cc -m -p main
commit 59d314ad6f356dd08601a4cd5e530381da3e3c64 (from 9a6d4949b6b76956d9d5e26f2791ec2ceff5fdc0)
Merge: 9a6d494 c7a2ab9
Author: A U Thor <author@example.com>

View File

@ -26,7 +26,7 @@ Date: Mon Jun 26 00:06:00 2006 +0000

Notes added by 'git notes add'

commit 59d314ad6f356dd08601a4cd5e530381da3e3c64 (HEAD -> refs/heads/master)
commit 59d314ad6f356dd08601a4cd5e530381da3e3c64 (HEAD -> refs/heads/main)
Merge: 9a6d494 c7a2ab9
Author: A U Thor <author@example.com>
Date: Mon Jun 26 00:04:00 2006 +0000

View File

@ -26,7 +26,7 @@ Date: Mon Jun 26 00:06:00 2006 +0000

Notes added by 'git notes add'

commit 59d314ad6f356dd08601a4cd5e530381da3e3c64 (HEAD -> refs/heads/master)
commit 59d314ad6f356dd08601a4cd5e530381da3e3c64 (HEAD -> refs/heads/main)
Merge: 9a6d494 c7a2ab9
Author: A U Thor <author@example.com>
Date: Mon Jun 26 00:04:00 2006 +0000

View File

@ -26,7 +26,7 @@ Date: Mon Jun 26 00:06:00 2006 +0000

Notes added by 'git notes add'

commit 59d314ad6f356dd08601a4cd5e530381da3e3c64 (HEAD -> refs/heads/master)
commit 59d314ad6f356dd08601a4cd5e530381da3e3c64 (HEAD -> refs/heads/main)
Merge: 9a6d494 c7a2ab9
Author: A U Thor <author@example.com>
Date: Mon Jun 26 00:04:00 2006 +0000

View File

@ -26,7 +26,7 @@ Date: Mon Jun 26 00:06:00 2006 +0000

Notes added by 'git notes add'

commit 59d314ad6f356dd08601a4cd5e530381da3e3c64 (HEAD -> master)
commit 59d314ad6f356dd08601a4cd5e530381da3e3c64 (HEAD -> main)
Merge: 9a6d494 c7a2ab9
Author: A U Thor <author@example.com>
Date: Mon Jun 26 00:04:00 2006 +0000

View File

@ -26,7 +26,7 @@ Date: Mon Jun 26 00:06:00 2006 +0000

Notes added by 'git notes add'

commit 59d314ad6f356dd08601a4cd5e530381da3e3c64 (HEAD -> master)
commit 59d314ad6f356dd08601a4cd5e530381da3e3c64 (HEAD -> main)
Merge: 9a6d494 c7a2ab9
Author: A U Thor <author@example.com>
Date: Mon Jun 26 00:04:00 2006 +0000

View File

@ -26,7 +26,7 @@ Date: Mon Jun 26 00:06:00 2006 +0000

Notes added by 'git notes add'

commit 59d314ad6f356dd08601a4cd5e530381da3e3c64 (HEAD -> master)
commit 59d314ad6f356dd08601a4cd5e530381da3e3c64 (HEAD -> main)
Merge: 9a6d494 c7a2ab9
Author: A U Thor <author@example.com>
Date: Mon Jun 26 00:04:00 2006 +0000

View File

@ -1,4 +1,4 @@
$ git log --diff-merges=first-parent master
$ git log --diff-merges=first-parent main
commit 59d314ad6f356dd08601a4cd5e530381da3e3c64
Merge: 9a6d494 c7a2ab9
Author: A U Thor <author@example.com>

View File

@ -1,4 +1,4 @@
$ git log --no-diff-merges -p --first-parent master
$ git log --diff-merges=off -p --first-parent main
commit 59d314ad6f356dd08601a4cd5e530381da3e3c64
Merge: 9a6d494 c7a2ab9
Author: A U Thor <author@example.com>

View File

@ -1,4 +1,4 @@
$ git log --first-parent --diff-merges=off -p master
$ git log --first-parent --diff-merges=off -p main
commit 80e25ffa65bcdbe82ef654b4d06dbbde7945c37f
Merge: 9a6d494 c7a2ab9
Author: A U Thor <author@example.com>

View File

@ -1,4 +1,4 @@
$ git log --diff-merges=off -p --first-parent master
$ git log --no-diff-merges -p --first-parent main
commit 59d314ad6f356dd08601a4cd5e530381da3e3c64
Merge: 9a6d494 c7a2ab9
Author: A U Thor <author@example.com>

View File

@ -1,4 +1,4 @@
$ git log --patch-with-stat --summary master -- dir/
$ git log --patch-with-stat --summary main -- dir/
commit 59d314ad6f356dd08601a4cd5e530381da3e3c64
Merge: 9a6d494 c7a2ab9
Author: A U Thor <author@example.com>

View File

@ -1,4 +1,4 @@
$ git log --patch-with-stat master
$ git log --patch-with-stat main
commit 59d314ad6f356dd08601a4cd5e530381da3e3c64
Merge: 9a6d494 c7a2ab9
Author: A U Thor <author@example.com>

View File

@ -1,4 +1,4 @@
$ git log --patch-with-stat master -- dir/
$ git log --patch-with-stat main -- dir/
commit 59d314ad6f356dd08601a4cd5e530381da3e3c64
Merge: 9a6d494 c7a2ab9
Author: A U Thor <author@example.com>

View File

@ -1,4 +1,4 @@
$ git log --root --cc --patch-with-stat --summary master
$ git log --root --cc --patch-with-stat --summary main
commit 59d314ad6f356dd08601a4cd5e530381da3e3c64
Merge: 9a6d494 c7a2ab9
Author: A U Thor <author@example.com>

View File

@ -1,4 +1,4 @@
$ git log --root --patch-with-stat --summary master
$ git log --root --patch-with-stat --summary main
commit 59d314ad6f356dd08601a4cd5e530381da3e3c64
Merge: 9a6d494 c7a2ab9
Author: A U Thor <author@example.com>

View File

@ -1,4 +1,4 @@
$ git log --root --patch-with-stat master
$ git log --root --patch-with-stat main
commit 59d314ad6f356dd08601a4cd5e530381da3e3c64
Merge: 9a6d494 c7a2ab9
Author: A U Thor <author@example.com>

View File

@ -1,4 +1,4 @@
$ git log --root -c --patch-with-stat --summary master
$ git log --root -c --patch-with-stat --summary main
commit 59d314ad6f356dd08601a4cd5e530381da3e3c64
Merge: 9a6d494 c7a2ab9
Author: A U Thor <author@example.com>

View File

@ -1,4 +1,4 @@
$ git log --root -p master
$ git log --root -p main
commit 59d314ad6f356dd08601a4cd5e530381da3e3c64
Merge: 9a6d494 c7a2ab9
Author: A U Thor <author@example.com>

View File

@ -1,4 +1,4 @@
$ git log --root master
$ git log --root main
commit 59d314ad6f356dd08601a4cd5e530381da3e3c64
Merge: 9a6d494 c7a2ab9
Author: A U Thor <author@example.com>

View File

@ -1,4 +1,4 @@
$ git log -GF -p --pickaxe-all master
$ git log -GF -p --pickaxe-all main
commit 9a6d4949b6b76956d9d5e26f2791ec2ceff5fdc0
Author: A U Thor <author@example.com>
Date: Mon Jun 26 00:02:00 2006 +0000

View File

@ -1,4 +1,4 @@
$ git log -GF -p master
$ git log -GF -p main
commit 9a6d4949b6b76956d9d5e26f2791ec2ceff5fdc0
Author: A U Thor <author@example.com>
Date: Mon Jun 26 00:02:00 2006 +0000

View File

@ -1,4 +1,4 @@
$ git log -SF master
$ git log -GF main
commit 9a6d4949b6b76956d9d5e26f2791ec2ceff5fdc0
Author: A U Thor <author@example.com>
Date: Mon Jun 26 00:02:00 2006 +0000

View File

@ -1,4 +1,4 @@
$ git log -IA -IB -I1 -I2 -p master
$ git log -IA -IB -I1 -I2 -p main
commit 59d314ad6f356dd08601a4cd5e530381da3e3c64
Merge: 9a6d494 c7a2ab9
Author: A U Thor <author@example.com>

View File

@ -1,4 +1,4 @@
$ git log -SF -p master
$ git log -SF -p main
commit 9a6d4949b6b76956d9d5e26f2791ec2ceff5fdc0
Author: A U Thor <author@example.com>
Date: Mon Jun 26 00:02:00 2006 +0000

View File

@ -1,4 +1,4 @@
$ git log -GF master
$ git log -SF main
commit 9a6d4949b6b76956d9d5e26f2791ec2ceff5fdc0
Author: A U Thor <author@example.com>
Date: Mon Jun 26 00:02:00 2006 +0000

View File

@ -0,0 +1,2 @@
$ git log -SF main --max-count=0
$

View File

@ -1,4 +1,4 @@
$ git log -SF master --max-count=2
$ git log -SF main --max-count=1
commit 9a6d4949b6b76956d9d5e26f2791ec2ceff5fdc0
Author: A U Thor <author@example.com>
Date: Mon Jun 26 00:02:00 2006 +0000

View File

@ -0,0 +1,7 @@
$ git log -SF main --max-count=2
commit 9a6d4949b6b76956d9d5e26f2791ec2ceff5fdc0
Author: A U Thor <author@example.com>
Date: Mon Jun 26 00:02:00 2006 +0000

Third
$

View File

@ -1,2 +0,0 @@
$ git log -SF master --max-count=0
$

View File

@ -1,7 +0,0 @@
$ git log -SF master --max-count=1
commit 9a6d4949b6b76956d9d5e26f2791ec2ceff5fdc0
Author: A U Thor <author@example.com>
Date: Mon Jun 26 00:02:00 2006 +0000

Third
$

View File

@ -1,4 +1,4 @@
$ git log -S F master
$ git log -S F main
commit 9a6d4949b6b76956d9d5e26f2791ec2ceff5fdc0
Author: A U Thor <author@example.com>
Date: Mon Jun 26 00:02:00 2006 +0000

View File

@ -1,4 +1,4 @@
$ git log --cc -m -p master
$ git log -c -m -p main
commit 59d314ad6f356dd08601a4cd5e530381da3e3c64 (from 9a6d4949b6b76956d9d5e26f2791ec2ceff5fdc0)
Merge: 9a6d494 c7a2ab9
Author: A U Thor <author@example.com>

View File

@ -1,4 +1,4 @@
$ git log -m --raw master
$ git log -m --raw main
commit 59d314ad6f356dd08601a4cd5e530381da3e3c64 (from 9a6d4949b6b76956d9d5e26f2791ec2ceff5fdc0)
Merge: 9a6d494 c7a2ab9
Author: A U Thor <author@example.com>

View File

@ -1,4 +1,4 @@
$ git log -m --stat master
$ git log -m --stat main
commit 59d314ad6f356dd08601a4cd5e530381da3e3c64 (from 9a6d4949b6b76956d9d5e26f2791ec2ceff5fdc0)
Merge: 9a6d494 c7a2ab9
Author: A U Thor <author@example.com>

View File

@ -1,4 +1,4 @@
$ git log -m -p --first-parent master
$ git log -m -p --first-parent main
commit 59d314ad6f356dd08601a4cd5e530381da3e3c64
Merge: 9a6d494 c7a2ab9
Author: A U Thor <author@example.com>

View File

@ -1,4 +1,4 @@
$ git log -m -p master
$ git log -m -p main
commit 59d314ad6f356dd08601a4cd5e530381da3e3c64 (from 9a6d4949b6b76956d9d5e26f2791ec2ceff5fdc0)
Merge: 9a6d494 c7a2ab9
Author: A U Thor <author@example.com>

View File

@ -1,4 +1,4 @@
$ git log -p --diff-merges=first-parent master
$ git log -p --diff-merges=first-parent main
commit 59d314ad6f356dd08601a4cd5e530381da3e3c64
Merge: 9a6d494 c7a2ab9
Author: A U Thor <author@example.com>

View File

@ -1,4 +1,4 @@
$ git log -p --first-parent master
$ git log -p --first-parent main
commit 59d314ad6f356dd08601a4cd5e530381da3e3c64
Merge: 9a6d494 c7a2ab9
Author: A U Thor <author@example.com>

View File

@ -1,4 +1,4 @@
$ git log -p master
$ git log -p main
commit 59d314ad6f356dd08601a4cd5e530381da3e3c64
Merge: 9a6d494 c7a2ab9
Author: A U Thor <author@example.com>

View File

@ -1,4 +1,4 @@
$ git log master
$ git log main
commit 59d314ad6f356dd08601a4cd5e530381da3e3c64
Merge: 9a6d494 c7a2ab9
Author: A U Thor <author@example.com>

View File

@ -1,4 +1,4 @@
$ git diff-tree -c --abbrev master
$ git diff-tree -c --abbrev main
59d314ad6f356dd08601a4cd5e530381da3e3c64
::100644 100644 100644 cead32e 7289e35 992913c MM dir/sub
::100644 100644 100644 b414108 f4615da 10a8a9f MM file0

View File

@ -1,4 +1,4 @@
$ git whatchanged --root master
$ git whatchanged --root main
commit c7a2ab9e8eac7b117442a607d5a9b3950ae34d5a
Author: A U Thor <author@example.com>
Date: Mon Jun 26 00:03:00 2006 +0000

View File

@ -1,4 +1,4 @@
$ git whatchanged -SF master
$ git whatchanged -SF main
commit 9a6d4949b6b76956d9d5e26f2791ec2ceff5fdc0
Author: A U Thor <author@example.com>
Date: Mon Jun 26 00:02:00 2006 +0000

View File

@ -1,4 +1,4 @@
$ git whatchanged master
$ git whatchanged main
commit c7a2ab9e8eac7b117442a607d5a9b3950ae34d5a
Author: A U Thor <author@example.com>
Date: Mon Jun 26 00:03:00 2006 +0000

View File

@ -1,4 +1,4 @@
$ git show --first-parent master
$ git show --first-parent main
commit 59d314ad6f356dd08601a4cd5e530381da3e3c64
Merge: 9a6d494 c7a2ab9
Author: A U Thor <author@example.com>

View File

@ -1,4 +1,4 @@
$ git show -c master
$ git show -c main
commit 59d314ad6f356dd08601a4cd5e530381da3e3c64
Merge: 9a6d494 c7a2ab9
Author: A U Thor <author@example.com>

View File

@ -1,4 +1,4 @@
$ git show -m master
$ git show -m main
commit 59d314ad6f356dd08601a4cd5e530381da3e3c64 (from 9a6d4949b6b76956d9d5e26f2791ec2ceff5fdc0)
Merge: 9a6d494 c7a2ab9
Author: A U Thor <author@example.com>

View File

@ -1,4 +1,4 @@
$ git show master
$ git show main
commit 59d314ad6f356dd08601a4cd5e530381da3e3c64
Merge: 9a6d494 c7a2ab9
Author: A U Thor <author@example.com>

View File

@ -1,4 +1,4 @@
$ git whatchanged --patch-with-stat --summary master -- dir/
$ git whatchanged --patch-with-stat --summary main -- dir/
commit c7a2ab9e8eac7b117442a607d5a9b3950ae34d5a
Author: A U Thor <author@example.com>
Date: Mon Jun 26 00:03:00 2006 +0000

View File

@ -1,4 +1,4 @@
$ git whatchanged --patch-with-stat master
$ git whatchanged --patch-with-stat main
commit c7a2ab9e8eac7b117442a607d5a9b3950ae34d5a
Author: A U Thor <author@example.com>
Date: Mon Jun 26 00:03:00 2006 +0000

View File

@ -1,4 +1,4 @@
$ git whatchanged --patch-with-stat master -- dir/
$ git whatchanged --patch-with-stat main -- dir/
commit c7a2ab9e8eac7b117442a607d5a9b3950ae34d5a
Author: A U Thor <author@example.com>
Date: Mon Jun 26 00:03:00 2006 +0000

View File

@ -1,4 +1,4 @@
$ git whatchanged --root --cc --patch-with-stat --summary master
$ git whatchanged --root --cc --patch-with-stat --summary main
commit 59d314ad6f356dd08601a4cd5e530381da3e3c64
Merge: 9a6d494 c7a2ab9
Author: A U Thor <author@example.com>

View File

@ -1,4 +1,4 @@
$ git whatchanged --root --patch-with-stat --summary master
$ git whatchanged --root --patch-with-stat --summary main
commit c7a2ab9e8eac7b117442a607d5a9b3950ae34d5a
Author: A U Thor <author@example.com>
Date: Mon Jun 26 00:03:00 2006 +0000

View File

@ -1,4 +1,4 @@
$ git whatchanged --root --patch-with-stat master
$ git whatchanged --root --patch-with-stat main
commit c7a2ab9e8eac7b117442a607d5a9b3950ae34d5a
Author: A U Thor <author@example.com>
Date: Mon Jun 26 00:03:00 2006 +0000

View File

@ -1,4 +1,4 @@
$ git whatchanged --root -c --patch-with-stat --summary master
$ git whatchanged --root -c --patch-with-stat --summary main
commit 59d314ad6f356dd08601a4cd5e530381da3e3c64
Merge: 9a6d494 c7a2ab9
Author: A U Thor <author@example.com>

View File

@ -1,4 +1,4 @@
$ git whatchanged --root -p master
$ git whatchanged --root -p main
commit c7a2ab9e8eac7b117442a607d5a9b3950ae34d5a
Author: A U Thor <author@example.com>
Date: Mon Jun 26 00:03:00 2006 +0000

Some files were not shown because too many files have changed in this diff Show More