Skip to content

Commit 5248665

Browse files
committed
doc: git-checkout: split up restoring files section
From user feedback: one user mentioned that "When the <tree-ish> (most often a commit) is not given" is confusing since it starts with a negative. Restructuring so that `git checkout main file.txt` and `git checkout file.txt` are separate items will help us simplify the sentence structure a lot. As a bonus, it appears that `-f` actually only applies to one of those forms, so we can include fewer options, and now the structure of the DESCRIPTION matches the SYNOPSIS. Signed-off-by: Julia Evans <[email protected]>
1 parent 99590b1 commit 5248665

File tree

1 file changed

+13
-10
lines changed

1 file changed

+13
-10
lines changed

Documentation/git-checkout.adoc

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ 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>...]
@@ -72,14 +72,17 @@ would overwrite your uncommitted changes.
7272
+
7373
Omitting _<branch>_ detaches `HEAD` at the tip of the current branch.
7474
75-
`git checkout [-f|--ours|--theirs|-m|--conflict=<style>] [<tree-ish>] [--] <pathspec>...`::
76-
`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]`::
7777
78-
Overwrite the contents of the files that match the pathspec.
79-
When the _<tree-ish>_ (most often a commit) is not given,
80-
overwrite working tree with the contents in the index.
81-
When the _<tree-ish>_ is given, overwrite both the index and
82-
the working tree with the contents at the _<tree-ish>_.
78+
Overwrite both the index and the working tree with the
79+
contents at the _<tree-ish>_ for the files that match the pathspec.
80+
81+
`git checkout [-f|--ours|--theirs|-m|--conflict=<style>] [--] <pathspec>...`::
82+
`git checkout [-f|--ours|--theirs|-m|--conflict=<style>] --pathspec-from-file=<file> [--pathspec-file-nul]`::
83+
84+
Overwrite working tree with the contents in the index for the files
85+
that match the pathspec.
8386
+
8487
The index may contain unmerged entries because of a previous failed merge.
8588
By default, if you try to check out such an entry from the index, the
@@ -90,7 +93,7 @@ using `--ours` or `--theirs`. With `-m`, changes made to the working tree
9093
file can be discarded to re-create the original conflicted merge result.
9194
9295
`git checkout (-p|--patch) [<tree-ish>] [--] [<pathspec>...]`::
93-
This is similar to the previous mode, but lets you use the
96+
This is similar to the previous two modes, but lets you use the
9497
interactive interface to show the "diff" output and choose which
9598
hunks to use in the result. See below for the description of
9699
`--patch` option.

0 commit comments

Comments
 (0)