doc: convert git-reset to new documentation format
- Switch the synopsis to a synopsis block which will automatically format placeholders in italics and keywords in monospace - Use _<placeholder>_ instead of <placeholder> in the description - Use `backticks` for keywords and more complex option descriptions. The new rendering engine will apply synopsis rules to these spans. Signed-off-by: Jean-Noël Avila <jn.avila@free.fr> Signed-off-by: Junio C Hamano <gitster@pobox.com>maint
parent
683c54c999
commit
5130704fca
|
@ -7,23 +7,23 @@ git-reset - Reset current HEAD to the specified state
|
|||
|
||||
SYNOPSIS
|
||||
--------
|
||||
[verse]
|
||||
'git reset' [-q] [<tree-ish>] [--] <pathspec>...
|
||||
'git reset' [-q] [--pathspec-from-file=<file> [--pathspec-file-nul]] [<tree-ish>]
|
||||
'git reset' (--patch | -p) [<tree-ish>] [--] [<pathspec>...]
|
||||
'git reset' [--soft | --mixed [-N] | --hard | --merge | --keep] [-q] [<commit>]
|
||||
[synopsis]
|
||||
git reset [-q] [<tree-ish>] [--] <pathspec>...
|
||||
git reset [-q] [--pathspec-from-file=<file> [--pathspec-file-nul]] [<tree-ish>]
|
||||
git reset (--patch | -p) [<tree-ish>] [--] [<pathspec>...]
|
||||
git reset [--soft | --mixed [-N] | --hard | --merge | --keep] [-q] [<commit>]
|
||||
|
||||
DESCRIPTION
|
||||
-----------
|
||||
In the first three forms, copy entries from `<tree-ish>` to the index.
|
||||
In the last form, set the current branch head (`HEAD`) to `<commit>`,
|
||||
In the first three forms, copy entries from _<tree-ish>_ to the index.
|
||||
In the last form, set the current branch head (`HEAD`) to _<commit>_,
|
||||
optionally modifying index and working tree to match.
|
||||
The `<tree-ish>`/`<commit>` defaults to `HEAD` in all forms.
|
||||
The _<tree-ish>_/_<commit>_ defaults to `HEAD` in all forms.
|
||||
|
||||
'git reset' [-q] [<tree-ish>] [--] <pathspec>...::
|
||||
'git reset' [-q] [--pathspec-from-file=<file> [--pathspec-file-nul]] [<tree-ish>]::
|
||||
`git reset [-q] [<tree-ish>] [--] <pathspec>...`::
|
||||
`git reset [-q] [--pathspec-from-file=<file> [--pathspec-file-nul]] [<tree-ish>]`::
|
||||
These forms reset the index entries for all paths that match the
|
||||
`<pathspec>` to their state at `<tree-ish>`. (It does not affect
|
||||
_<pathspec>_ to their state at _<tree-ish>_. (It does not affect
|
||||
the working tree or the current branch.)
|
||||
+
|
||||
This means that `git reset <pathspec>` is the opposite of `git add
|
||||
|
@ -37,30 +37,30 @@ and specifying a commit with `--source`, you
|
|||
can copy the contents of a path out of a commit to the index and to the
|
||||
working tree in one go.
|
||||
|
||||
'git reset' (--patch | -p) [<tree-ish>] [--] [<pathspec>...]::
|
||||
`git reset (--patch | -p) [<tree-ish>] [--] [<pathspec>...]`::
|
||||
Interactively select hunks in the difference between the index
|
||||
and `<tree-ish>` (defaults to `HEAD`). The chosen hunks are applied
|
||||
and _<tree-ish>_ (defaults to `HEAD`). The chosen hunks are applied
|
||||
in reverse to the index.
|
||||
+
|
||||
This means that `git reset -p` is the opposite of `git add -p`, i.e.
|
||||
you can use it to selectively reset hunks. See the ``Interactive Mode''
|
||||
you can use it to selectively reset hunks. See the "Interactive Mode"
|
||||
section of linkgit:git-add[1] to learn how to operate the `--patch` mode.
|
||||
|
||||
'git reset' [<mode>] [<commit>]::
|
||||
This form resets the current branch head to `<commit>` and
|
||||
possibly updates the index (resetting it to the tree of `<commit>`) and
|
||||
the working tree depending on `<mode>`. Before the operation, `ORIG_HEAD`
|
||||
is set to the tip of the current branch. If `<mode>` is omitted,
|
||||
defaults to `--mixed`. The `<mode>` must be one of the following:
|
||||
`git reset [<mode>] [<commit>]`::
|
||||
This form resets the current branch head to _<commit>_ and
|
||||
possibly updates the index (resetting it to the tree of _<commit>_) and
|
||||
the working tree depending on _<mode>_. Before the operation, `ORIG_HEAD`
|
||||
is set to the tip of the current branch. If _<mode>_ is omitted,
|
||||
defaults to `--mixed`. The _<mode>_ must be one of the following:
|
||||
+
|
||||
--
|
||||
--soft::
|
||||
`--soft`::
|
||||
Does not touch the index file or the working tree at all (but
|
||||
resets the head to `<commit>`, just like all modes do). This leaves
|
||||
resets the head to _<commit>_, just like all modes do). This leaves
|
||||
all your changed files "Changes to be committed", as `git status`
|
||||
would put it.
|
||||
|
||||
--mixed::
|
||||
`--mixed`::
|
||||
Resets the index but not the working tree (i.e., the changed files
|
||||
are preserved but not marked for commit) and reports what has not
|
||||
been updated. This is the default action.
|
||||
|
@ -68,33 +68,33 @@ section of linkgit:git-add[1] to learn how to operate the `--patch` mode.
|
|||
If `-N` is specified, removed paths are marked as intent-to-add (see
|
||||
linkgit:git-add[1]).
|
||||
|
||||
--hard::
|
||||
`--hard`::
|
||||
Resets the index and working tree. Any changes to tracked files in the
|
||||
working tree since `<commit>` are discarded. Any untracked files or
|
||||
working tree since _<commit>_ are discarded. Any untracked files or
|
||||
directories in the way of writing any tracked files are simply deleted.
|
||||
|
||||
--merge::
|
||||
`--merge`::
|
||||
Resets the index and updates the files in the working tree that are
|
||||
different between `<commit>` and `HEAD`, but keeps those which are
|
||||
different between _<commit>_ and `HEAD`, but keeps those which are
|
||||
different between the index and working tree (i.e. which have changes
|
||||
which have not been added).
|
||||
If a file that is different between `<commit>` and the index has
|
||||
If a file that is different between _<commit>_ and the index has
|
||||
unstaged changes, reset is aborted.
|
||||
+
|
||||
In other words, `--merge` does something like a `git read-tree -u -m <commit>`,
|
||||
but carries forward unmerged index entries.
|
||||
|
||||
--keep::
|
||||
`--keep`::
|
||||
Resets index entries and updates files in the working tree that are
|
||||
different between `<commit>` and `HEAD`.
|
||||
If a file that is different between `<commit>` and `HEAD` has local
|
||||
different between _<commit>_ and `HEAD`.
|
||||
If a file that is different between _<commit>_ and `HEAD` has local
|
||||
changes, reset is aborted.
|
||||
|
||||
--[no-]recurse-submodules::
|
||||
When the working tree is updated, using --recurse-submodules will
|
||||
`--[no-]recurse-submodules`::
|
||||
When the working tree is updated, using `--recurse-submodules` will
|
||||
also recursively reset the working tree of all active submodules
|
||||
according to the commit recorded in the superproject, also setting
|
||||
the submodules' HEAD to be detached at that commit.
|
||||
the submodules' `HEAD` to be detached at that commit.
|
||||
--
|
||||
|
||||
See "Reset, restore and revert" in linkgit:git[1] for the differences
|
||||
|
@ -104,31 +104,31 @@ between the three commands.
|
|||
OPTIONS
|
||||
-------
|
||||
|
||||
-q::
|
||||
--quiet::
|
||||
`-q`::
|
||||
`--quiet`::
|
||||
Be quiet, only report errors.
|
||||
|
||||
--refresh::
|
||||
--no-refresh::
|
||||
`--refresh`::
|
||||
`--no-refresh`::
|
||||
Refresh the index after a mixed reset. Enabled by default.
|
||||
|
||||
--pathspec-from-file=<file>::
|
||||
Pathspec is passed in `<file>` instead of commandline args. If
|
||||
`<file>` is exactly `-` then standard input is used. Pathspec
|
||||
elements are separated by LF or CR/LF. Pathspec elements can be
|
||||
`--pathspec-from-file=<file>`::
|
||||
Pathspec is passed in _<file>_ instead of commandline args. If
|
||||
_<file>_ is exactly `-` then standard input is used. Pathspec
|
||||
elements are separated by _LF_ or _CR_/_LF_. Pathspec elements can be
|
||||
quoted as explained for the configuration variable `core.quotePath`
|
||||
(see linkgit:git-config[1]). See also `--pathspec-file-nul` and
|
||||
global `--literal-pathspecs`.
|
||||
|
||||
--pathspec-file-nul::
|
||||
`--pathspec-file-nul`::
|
||||
Only meaningful with `--pathspec-from-file`. Pathspec elements are
|
||||
separated with NUL character and all other characters are taken
|
||||
separated with _NUL_ character and all other characters are taken
|
||||
literally (including newlines and quotes).
|
||||
|
||||
\--::
|
||||
`--`::
|
||||
Do not interpret any more arguments as options.
|
||||
|
||||
<pathspec>...::
|
||||
`<pathspec>...`::
|
||||
Limits the paths affected by the operation.
|
||||
+
|
||||
For more details, see the 'pathspec' entry in linkgit:gitglossary[7].
|
||||
|
@ -348,7 +348,7 @@ $ git commit ... <8>
|
|||
------------
|
||||
+
|
||||
<1> First, reset the history back one commit so that we remove the original
|
||||
commit, but leave the working tree with all the changes. The -N ensures
|
||||
commit, but leave the working tree with all the changes. The `-N` ensures
|
||||
that any new files added with `HEAD` are still marked so that `git add -p`
|
||||
will find them.
|
||||
<2> Next, we interactively select diff hunks to add using the `git add -p`
|
||||
|
@ -458,7 +458,7 @@ working index HEAD target working index HEAD
|
|||
--keep B C C
|
||||
....
|
||||
|
||||
`reset --merge` is meant to be used when resetting out of a conflicted
|
||||
`git reset --merge` is meant to be used when resetting out of a conflicted
|
||||
merge. Any mergy operation guarantees that the working tree file that is
|
||||
involved in the merge does not have a local change with respect to the index
|
||||
before it starts, and that it writes the result out to the working tree. So if
|
||||
|
@ -467,7 +467,7 @@ between the index and the working tree, then it means that we are not
|
|||
resetting out from a state that a mergy operation left after failing
|
||||
with a conflict. That is why we disallow `--merge` option in this case.
|
||||
|
||||
`reset --keep` is meant to be used when removing some of the last
|
||||
`git reset --keep` is meant to be used when removing some of the last
|
||||
commits in the current branch while keeping changes in the working
|
||||
tree. If there could be conflicts between the changes in the commit we
|
||||
want to remove and the changes in the working tree we want to keep,
|
||||
|
|
Loading…
Reference in New Issue