git-reset.txt: make modes description more consistent

Currently, the structure of the individual mode entries is different
which makes it difficult to grasp the differences between the modes.
Also, the same items are named differently (e.g. <commit>, "the named
commit", "the given commit", "the commit being switched to").

Structure and word all mode entries consistently.

Signed-off-by: Michael J Gruber <git@drmicha.warpmail.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Michael J Gruber 2010-09-15 22:47:44 +02:00 коммит произвёл Junio C Hamano
Родитель 9980d7de93
Коммит d537c7492b
1 изменённых файлов: 26 добавлений и 17 удалений

Просмотреть файл

@ -15,13 +15,13 @@ SYNOPSIS
DESCRIPTION DESCRIPTION
----------- -----------
In the first and second form, copy entries from <commit> to the index. In the first and second form, copy entries from <commit> to the index.
In the third form, set the current branch head to <commit>, optionally In the third form, set the current branch head (HEAD) to <commit>, optionally
modifying index and working tree to match. The <commit> defaults to HEAD modifying index and working tree to match. The <commit> defaults to HEAD
in all forms. in all forms.
'git reset' [-q] [<commit>] [--] <paths>...:: 'git reset' [-q] [<commit>] [--] <paths>...::
This form resets the index entries for all <paths> to their This form resets the index entries for all <paths> to their
state at the <commit>. (It does not affect the working tree, nor state at <commit>. (It does not affect the working tree, nor
the current branch.) the current branch.)
+ +
This means that `git reset <paths>` is the opposite of `git add This means that `git reset <paths>` is the opposite of `git add
@ -43,9 +43,10 @@ This means that `git reset -p` is the opposite of `git add -p` (see
linkgit:git-add[1]). linkgit:git-add[1]).
'git reset' [--<mode>] [<commit>]:: 'git reset' [--<mode>] [<commit>]::
This form resets the current branch head to <commit> and then This form resets the current branch head to <commit> and
updates index and working tree according to <mode>, which must possibly updates the index (resetting it to the tree of <commit>) and
be one of the following: the working tree depending on <mode>, which
must be one of the following:
+ +
-- --
--soft:: --soft::
@ -60,22 +61,30 @@ linkgit:git-add[1]).
been updated. This is the default action. been updated. This is the default action.
--hard:: --hard::
Matches the working tree and index to that of the tree being Resets the index and working tree. Any changes to tracked files in the
switched to. Any changes to tracked files in the working tree working tree since <commit> are discarded.
since <commit> are lost.
--merge:: --merge::
Resets the index to match the tree recorded by the named commit, Resets the index and updates the files in the working tree that are
and updates the files that are different between the named commit different between <commit> and HEAD, but keeps those which are
and the current commit in the working tree. 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 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::
Reset the index to the given commit, keeping local changes in Resets the index, updates files in the working tree that are
the working tree since the current commit, while updating different between <commit> and HEAD, but keeps those
working tree files without local changes to what appears in which are different between HEAD and the working tree (i.e.
the given commit. If a file that is different between the which have local changes).
current commit and the given commit has local changes, reset If a file that is different between <commit> and HEAD has local changes,
is aborted. reset is aborted.
+
In other words, --keep does a 2-way merge between <commit> and HEAD followed by
'git reset --mixed <commit>'.
-- --
If you want to undo a commit other than the latest on a branch, If you want to undo a commit other than the latest on a branch,