@@ -8,29 +8,39 @@ git-reset - Reset current HEAD to the specified state
8
8
SYNOPSIS
9
9
--------
10
10
[verse]
11
- 'git reset' [--soft | --mixed | --hard | --merge | --keep] [-q] [<commit>]
12
11
'git reset' [-q] [<commit>] [--] <paths>...
13
12
'git reset' --patch [<commit>] [--] [<paths>...]
13
+ 'git reset' [--soft | --mixed | --hard | --merge | --keep] [-q] [<commit>]
14
14
15
15
DESCRIPTION
16
16
-----------
17
- Sets the current head to the specified commit and optionally resets the
18
- index and working tree to match.
19
-
20
- This command is useful if you notice some small error in a recent
21
- commit (or set of commits) and want to redo that part without showing
22
- the undo in the history.
23
-
24
- If you want to undo a commit other than the latest on a branch,
25
- linkgit:git-revert[1] is your friend.
26
-
27
- The second and third forms with 'paths' and/or --patch are used to
28
- revert selected paths in the index from a given commit, without moving
29
- HEAD.
17
+ In the first and second form, copy entries from <commit> to the index.
18
+ In the third form, set the current branch to <commit>, optionally
19
+ modifying index and worktree to match. The <commit> defaults to HEAD
20
+ in all forms.
21
+
22
+ 'git reset' [-q] [<commit>] [--] <paths>...::
23
+ This form resets the index entries for all <paths> to their
24
+ state at the <commit>. (It does not affect the worktree, nor
25
+ the current branch.)
26
+ +
27
+ This means that `git reset <paths>` is the opposite of `git add
28
+ <paths>`.
30
29
30
+ 'git reset' --patch|-p [<commit>] [--] [<paths>...]::
31
+ Interactively select hunks in the difference between the index
32
+ and <commit> (defaults to HEAD). The chosen hunks are applied
33
+ in reverse to the index.
34
+ +
35
+ This means that `git reset -p` is the opposite of `git add -p` (see
36
+ linkgit:git-add[1]).
31
37
32
- OPTIONS
33
- -------
38
+ 'git reset' [--<mode>] [<commit>]::
39
+ This form points the current branch to <commit> and then
40
+ updates index and working tree according to <mode>, which must
41
+ be one of the following:
42
+ +
43
+ --
34
44
--soft::
35
45
Does not touch the index file nor the working tree at all, but
36
46
requires them to be in a good order. This leaves all your changed
@@ -59,22 +69,19 @@ OPTIONS
59
69
the given commit. If a file that is different between the
60
70
current commit and the given commit has local changes, reset
61
71
is aborted.
72
+ --
62
73
63
- -p::
64
- --patch::
65
- Interactively select hunks in the difference between the index
66
- and <commit> (defaults to HEAD). The chosen hunks are applied
67
- in reverse to the index.
68
- +
69
- This means that `git reset -p` is the opposite of `git add -p` (see
70
- linkgit:git-add[1]).
74
+ If you want to undo a commit other than the latest on a branch,
75
+ linkgit:git-revert[1] is your friend.
76
+
77
+
78
+ OPTIONS
79
+ -------
71
80
72
81
-q::
73
82
--quiet::
74
83
Be quiet, only report errors.
75
84
76
- <commit>::
77
- Commit to make the current HEAD. If not given defaults to HEAD.
78
85
79
86
DISCUSSION
80
87
----------
0 commit comments