Skip to content

Commit 8d8d743

Browse files
committed
Autogenerated HTML docs for v2.51.0-372-g821f58
1 parent 510d706 commit 8d8d743

File tree

9 files changed

+243
-159
lines changed

9 files changed

+243
-159
lines changed

‎BreakingChanges.adoc‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,12 @@ A prerequisite for this change is that the ecosystem is ready to support the
165165
"reftable" format. Most importantly, alternative implementations of Git like
166166
JGit, libgit2 and Gitoxide need to support it.
167167

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

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

‎BreakingChanges.html‎

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -687,6 +687,13 @@ <h3 id="_changes">Changes</h3>
687687
</ul>
688688
</div>
689689
</li>
690+
<li>
691+
<p>In new repositories, the default branch name will be <code>main</code>. We have been
692+
warning that the default name will change since 675704c74dd (init:
693+
provide useful advice about init.defaultBranch, 2020-12-11). The new name
694+
matches the default branch name used in new repositories by many of the
695+
big Git forges.</p>
696+
</li>
690697
</ul>
691698
</div>
692699
</div>
@@ -832,7 +839,7 @@ <h2 id="_superseded_features_that_will_not_be_deprecated">Superseded features th
832839
</div>
833840
<divid="footer">
834841
<divid="footer-text">
835-
Last updated 2025-09-23 13:59:22 -0700
842+
Last updated 2025-09-29 13:02:52 -0700
836843
</div>
837844
</div>
838845
</body>

‎RelNotes/2.52.0.adoc‎

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,15 @@ UI, Workflows & Features
3535
allow the "partialCloneFilter" settings and the "token" value to be
3636
communicated from the server side.
3737

38+
* Declare that "git init" that is not otherwise configured uses
39+
'main' as the initial branch, not 'master', starting Git 3.0.
40+
41+
* Keep giving hint about the default initial branch name for users
42+
who may be surprised after Git 3.0 switch-over.
43+
44+
* The stash.index configuration variable can be set to make "git stash
45+
pop/apply" pretend that it was invoked with "--index".
46+
3847

3948
Performance, Internal Implementation, Development Support etc.
4049
--------------------------------------------------------------
@@ -87,6 +96,12 @@ Performance, Internal Implementation, Development Support etc.
8796
* "git range-diff" learned a way to limit the memory consumed by
8897
O(N*N) cost matrix.
8998
99+
* Some places in the code confused a variable that is *not* a boolean
100+
to enable color but is an enum that records what the user requested
101+
to do about color. A couple of bugs of this sort have been fixed,
102+
while the code has been cleaned up to prevent similar bugs in the
103+
future.
104+
90105
91106
Fixes since v2.51
92107
-----------------
@@ -217,6 +232,33 @@ including security updates, are included in this release.
217232
* "git subtree" (in contrib/) did not work correctly when splitting
218233
squashed subtrees, which has been improved.
219234

235+
* Import a newer version of the clar unit testing framework.
236+
(merge 93dbb6b3c5 ps/clar-updates later to maint).
237+
238+
* "git send-email --compose --reply-to=<address>" used to add
239+
duplicated Reply-To: header, which made mailservers unhappy. This
240+
has been corrected.
241+
(merge f448f65719 nb/send-email-no-dup-reply-to later to maint).
242+
243+
* "git rebase -i" failed to clean-up the commit log message when the
244+
command commits the final one in a chain of "fixup" commands, which
245+
has been corrected.
246+
(merge 82a0a73e15 pw/rebase-i-cleanup-fix later to maint).
247+
248+
* There are double frees and leaks around setup_revisions() API used
249+
in "git stash show", which has been fixed, and setup_revisions()
250+
API gained a wrapper to make it more ergonomic when using it with
251+
strvec-manged argc/argv pairs.
252+
(merge a04bc71725 jk/setup-revisions-freefix later to maint).
253+
254+
* Deal more gracefully with directory / file conflicts when the files
255+
backend is used for ref storage, by failing only the ones that are
256+
involved in the conflict while allowing others.
257+
(merge 948b2ab0d8 kn/refs-files-case-insensitive later to maint).
258+
259+
* "git last-modified" operating in non-recursive mode used to trigger
260+
a BUG(), which has been corrected.
261+
220262
* Other code cleanup, docfix, build fix, etc.
221263
(merge 823d537fa7 kh/doc-git-log-markup-fix later to maint).
222264
(merge cf7efa4f33 rj/t6137-cygwin-fix later to maint).

‎git-checkout.adoc‎

Lines changed: 76 additions & 75 deletions
Original file line numberDiff line numberDiff line change
@@ -12,25 +12,29 @@ git checkout [-q] [-f] [-m] [<branch>]
1212
git checkout [-q] [-f] [-m] --detach [<branch>]
1313
git checkout [-q] [-f] [-m] [--detach] <commit>
1414
git checkout [-q] [-f] [-m] [[-b|-B|--orphan] <new-branch>] [<start-point>]
15-
git checkout [-f] <tree-ish> [--] <pathspec>...
16-
git checkout [-f] <tree-ish> --pathspec-from-file=<file> [--pathspec-file-nul]
15+
git checkout <tree-ish> [--] <pathspec>...
16+
git checkout <tree-ish> --pathspec-from-file=<file> [--pathspec-file-nul]
1717
git checkout [-f|--ours|--theirs|-m|--conflict=<style>] [--] <pathspec>...
1818
git checkout [-f|--ours|--theirs|-m|--conflict=<style>] --pathspec-from-file=<file> [--pathspec-file-nul]
1919
git checkout (-p|--patch) [<tree-ish>] [--] [<pathspec>...]
2020
2121
DESCRIPTION
2222
-----------
23-
Updates files in the working tree to match the version in the index
24-
or the specified tree. If no pathspec was given, `git checkout` will
25-
also update `HEAD` to set the specified branch as the current
26-
branch.
23+
24+
`git checkout` has two main modes:
25+
26+
1. **Switch branches**, with `git checkout <branch>`
27+
2. **Restore a different version of a file**, for example with
28+
`git checkout <commit> <filename>` or `git checkout <filename>`
29+
30+
See ARGUMENT DISAMBIGUATION below for how Git decides which one to do.
2731
2832
`git checkout [<branch>]`::
29-
To prepare for working on _<branch>_, switch to it by updating
30-
the index and the files in the working tree, and by pointing
31-
`HEAD` at the branch. Local modifications to the files in the
32-
working tree are kept, so that they can be committed to the
33-
_<branch>_.
33+
Switch to _<branch>_. This sets the current branch to _<branch>_ and
34+
updates the files in your working directory. The checkout will fail
35+
if there are uncommitted changes to any files where _<branch>_ and
36+
your current commit have different content. Uncommitted changes will
37+
otherwise be kept.
3438
+
3539
If _<branch>_ is not found but there does exist a tracking branch in
3640
exactly one remote (call it _<remote>_) with a matching name and
@@ -40,68 +44,63 @@ exactly one remote (call it _<remote>_) with a matching name and
4044
$ git checkout -b <branch> --track <remote>/<branch>
4145
------------
4246
+
43-
You could omit _<branch>_, in which case the command degenerates to
44-
"check out the current branch", which is a glorified no-op with
45-
rather expensive side-effects to show only the tracking information,
46-
if it exists, for the current branch.
47-
48-
`git checkout (-b|-B) <new-branch> [<start-point>]`::
49-
50-
Specifying `-b` causes a new branch to be created as if
51-
linkgit:git-branch[1] were called and then checked out. In
52-
this case you can use the `--track` or `--no-track` options,
53-
which will be passed to `git branch`. As a convenience,
54-
`--track` without `-b` implies branch creation; see the
55-
description of `--track` below.
56-
+
57-
If `-B` is given, _<new-branch>_ is created if it doesn't exist; otherwise, it
58-
is reset. This is the transactional equivalent of
59-
+
60-
------------
61-
$ git branch -f <branch> [<start-point>]
62-
$ git checkout <branch>
63-
------------
47+
Running `git checkout` without specifying a branch has no effect except
48+
to print out the tracking information for the current branch.
49+
50+
`git checkout -b <new-branch> [<start-point>]`::
51+
52+
Create a new branch named _<new-branch>_, start it at _<start-point>_
53+
(defaults to the current commit), and check out the new branch.
54+
You can use the `--track` or `--no-track` options to set the branch's
55+
upstream tracking information.
6456
+
65-
that is to say, the branch is not reset/created unless "git checkout" is
66-
successful (e.g., when the branch is in use in another worktree, not
67-
just the current branch stays the same, but the branch is not reset to
68-
the start-point, either).
57+
This will fail if there's an error checking out _<new-branch>_, for
58+
example if checking out the `<start-point>` commit would overwrite your
59+
uncommitted changes.
60+
61+
`git checkout -B <branch> [<start-point>]`::
62+
63+
The same as `-b`, except that if the branch already exists it
64+
resets `_<branch>_` to the start point instead of failing.
6965
7066
`git checkout --detach [<branch>]`::
7167
`git checkout [--detach] <commit>`::
7268
73-
Prepare to work on top of _<commit>_, by detaching `HEAD` at it
74-
(see "DETACHED HEAD" section), and updating the index and the
75-
files in the working tree. Local modifications to the files
76-
in the working tree are kept, so that the resulting working
77-
tree will be the state recorded in the commit plus the local
78-
modifications.
79-
+
80-
When the _<commit>_ argument is a branch name, the `--detach` option can
81-
be used to detach `HEAD` at the tip of the branch (`git checkout
82-
<branch>` would check out that branch without detaching `HEAD`).
69+
The same as `git checkout <branch>`, except that instead of pointing
70+
`HEAD` at the branch, it points `HEAD` at the commit ID.
71+
See the "DETACHED HEAD" section below for more.
8372
+
8473
Omitting _<branch>_ detaches `HEAD` at the tip of the current branch.
8574
86-
`git checkout [-f|--ours|--theirs|-m|--conflict=<style>] [<tree-ish>] [--] <pathspec>...`::
87-
`git checkout [-f|--ours|--theirs|-m|--conflict=<style>] [<tree-ish>] --pathspec-from-file=<file> [--pathspec-file-nul]`::
75+
`git checkout <tree-ish> [--] <pathspec>...`::
76+
`git checkout <tree-ish> --pathspec-from-file=<file> [--pathspec-file-nul]`::
8877
89-
Overwrite the contents of the files that match the pathspec.
90-
When the _<tree-ish>_ (most often a commit) is not given,
91-
overwrite working tree with the contents in the index.
92-
When the _<tree-ish>_ is given, overwrite both the index and
93-
the working tree with the contents at the _<tree-ish>_.
78+
Replace the specified files and/or directories with the version from
79+
the given commit or tree and add them to the index
80+
(also known as "staging area").
9481
+
95-
The index may contain unmerged entries because of a previous failed merge.
96-
By default, if you try to check out such an entry from the index, the
97-
checkout operation will fail and nothing will be checked out.
98-
Using `-f` will ignore these unmerged entries. The contents from a
99-
specific side of the merge can be checked out of the index by
100-
using `--ours` or `--theirs`. With `-m`, changes made to the working tree
101-
file can be discarded to re-create the original conflicted merge result.
82+
For example, `git checkout main file.txt` will replace `file.txt`
83+
with the version from `main`.
84+
85+
`git checkout [-f|--ours|--theirs|-m|--conflict=<style>] [--] <pathspec>...`::
86+
`git checkout [-f|--ours|--theirs|-m|--conflict=<style>] --pathspec-from-file=<file> [--pathspec-file-nul]`::
87+
88+
Replace the specified files and/or directories with the version from
89+
the index.
90+
+
91+
For example, if you check out a commit, edit `file.txt`, and then
92+
decide those changes were a mistake, `git checkout file.txt` will
93+
discard any unstaged changes to `file.txt`.
94+
+
95+
This will fail if the file has a merge conflict and you haven't yet run
96+
`git add file.txt` (or something equivalent) to mark it as resolved.
97+
You can use `-f` to ignore the unmerged files instead of failing, use
98+
`--ours` or `--theirs` to replace them with the version from a specific
99+
side of the merge, or use `-m` to replace them with the original
100+
conflicted merge result.
102101
103102
`git checkout (-p|--patch) [<tree-ish>] [--] [<pathspec>...]`::
104-
This is similar to the previous mode, but lets you use the
103+
This is similar to the previous two modes, but lets you use the
105104
interactive interface to show the "diff" output and choose which
106105
hunks to use in the result. See below for the description of
107106
`--patch` option.
@@ -155,16 +154,14 @@ of it").
155154
see linkgit:git-branch[1] for details.
156155
157156
`-B <new-branch>`::
158-
Creates the branch _<new-branch>_, start it at _<start-point>_;
159-
if it already exists, then reset it to _<start-point>_. And then
160-
check the resulting branch out. This is equivalent to running
161-
`git branch` with `-f` followed by `git checkout` of that branch;
162-
see linkgit:git-branch[1] for details.
157+
The same as `-b`, except that if the branch already exists it
158+
resets `_<branch>_` to the start point instead of failing.
163159
164160
`-t`::
165161
`--track[=(direct|inherit)]`::
166162
When creating a new branch, set up "upstream" configuration. See
167-
`--track` in linkgit:git-branch[1] for details.
163+
`--track` in linkgit:git-branch[1] for details. As a convenience,
164+
--track without -b implies branch creation.
168165
+
169166
If no `-b` option is given, the name of the new branch will be
170167
derived from the remote-tracking branch, by looking at the local part of
@@ -511,14 +508,18 @@ $ git log -g -2 HEAD
511508
ARGUMENT DISAMBIGUATION
512509
-----------------------
513510
514-
When there is only one argument given and it is not `--` (e.g. `git
515-
checkout abc`), and when the argument is both a valid _<tree-ish>_
516-
(e.g. a branch `abc` exists) and a valid _<pathspec>_ (e.g. a file
517-
or a directory whose name is "abc" exists), Git would usually ask
518-
you to disambiguate. Because checking out a branch is so common an
519-
operation, however, `git checkout abc` takes "abc" as a _<tree-ish>_
520-
in such a situation. Use `git checkout -- <pathspec>` if you want
521-
to checkout these paths out of the index.
511+
When you run `git checkout <something>`, Git tries to guess whether
512+
`<something>` is intended to be a branch, a commit, or aset of file(s),
513+
and then either switches to that branch or commit, or restores the
514+
specified files.
515+
516+
If there's any ambiguity, Git will treat `<something>` as a branch or
517+
commit, but you can use the double dash `--` to force Git to treat the
518+
parameter as a list of files and/or directories, like this:
519+
520+
----------
521+
git checkout -- file.txt
522+
----------
522523
523524
EXAMPLES
524525
--------

0 commit comments

Comments
(0)