Skip to content

Commit 772f811

Browse files
committed
Merge branch 'mz/reset-misc'
Various 'reset' optimizations and clean-ups, followed by a change to allow "git reset" to work even on an unborn branch. * mz/reset-misc: reset: update documentation to require only tree-ish with paths reset [--mixed]: use diff-based reset whether or not pathspec was given reset: allow reset on unborn branch reset $sha1 $pathspec: require $sha1 only to be treeish reset.c: inline update_index_refresh() reset.c: finish entire cmd_reset() whether or not pathspec is given reset [--mixed]: only write index file once reset.c: move lock, write and commit out of update_index_refresh() reset.c: move update_index_refresh() call out of read_from_tree() reset.c: replace switch by if-else reset: avoid redundant error message reset --keep: only write index file once reset.c: share call to die_if_unmerged_cache() reset.c: extract function for updating {ORIG_,}HEAD reset.c: remove unnecessary variable 'i' reset.c: extract function for parsing arguments reset: don't allow "git reset -- $pathspec" in bare repo reset.c: pass pathspec around instead of (prefix, argv) pair reset $pathspec: exit with code 0 if successful reset $pathspec: no need to discard index
2 parents 9a9f243 + bf44142 commit 772f811

File tree

5 files changed

+214
-171
lines changed

5 files changed

+214
-171
lines changed

Documentation/git-reset.txt

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,20 +8,20 @@ git-reset - Reset current HEAD to the specified state
88
SYNOPSIS
99
--------
1010
[verse]
11-
'git reset' [-q] [<commit>] [--] <paths>...
12-
'git reset' (--patch | -p) [<commit>] [--] [<paths>...]
11+
'git reset' [-q] [<tree-ish>] [--] <paths>...
12+
'git reset' (--patch | -p) [<tree-sh>] [--] [<paths>...]
1313
'git reset' [--soft | --mixed | --hard | --merge | --keep] [-q] [<commit>]
1414

1515
DESCRIPTION
1616
-----------
17-
In the first and second form, copy entries from <commit> to the index.
17+
In the first and second form, copy entries from <tree-ish> to the index.
1818
In the third form, set the current branch head (HEAD) to <commit>, optionally
19-
modifying index and working tree to match. The <commit> defaults to HEAD
20-
in all forms.
19+
modifying index and working tree to match. The <tree-ish>/<commit> defaults
20+
to HEAD in all forms.
2121

22-
'git reset' [-q] [<commit>] [--] <paths>...::
22+
'git reset' [-q] [<tree-ish>] [--] <paths>...::
2323
This form resets the index entries for all <paths> to their
24-
state at <commit>. (It does not affect the working tree, nor
24+
state at <tree-ish>. (It does not affect the working tree, nor
2525
the current branch.)
2626
+
2727
This means that `git reset <paths>` is the opposite of `git add
@@ -34,9 +34,9 @@ Alternatively, using linkgit:git-checkout[1] and specifying a commit, you
3434
can copy the contents of a path out of a commit to the index and to the
3535
working tree in one go.
3636

37-
'git reset' (--patch | -p) [<commit>] [--] [<paths>...]::
37+
'git reset' (--patch | -p) [<tree-ish>] [--] [<paths>...]::
3838
Interactively select hunks in the difference between the index
39-
and <commit> (defaults to HEAD). The chosen hunks are applied
39+
and <tree-ish> (defaults to HEAD). The chosen hunks are applied
4040
in reverse to the index.
4141
+
4242
This means that `git reset -p` is the opposite of `git add -p`, i.e.

0 commit comments

Comments
 (0)