Skip to content

Commit 413b90f

Browse files
committed
Merge branch 'maint'
* maint: Documentation/git-reset: Add an example of resetting selected paths Documentation/git-reset: don't mention --mixed for selected-paths reset Documentation/git-reset:
2 parents e7e5170 + 965053b commit 413b90f

File tree

1 file changed

+20
-3
lines changed

1 file changed

+20
-3
lines changed

Documentation/git-reset.txt

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ git-reset - Reset current HEAD to the specified state
88
SYNOPSIS
99
--------
1010
[verse]
11-
'git-reset' [--mixed | --soft | --hard] [-q] [<commit>]
12-
'git-reset' [--mixed] [-q] [<commit>] [--] <paths>...
11+
'git reset' [--mixed | --soft | --hard] [-q] [<commit>]
12+
'git reset' [-q] [<commit>] [--] <paths>...
1313

1414
DESCRIPTION
1515
-----------
@@ -37,7 +37,7 @@ OPTIONS
3737
--soft::
3838
Does not touch the index file nor the working tree at all, but
3939
requires them to be in a good order. This leaves all your changed
40-
files "Added but not yet committed", as linkgit:git-status[1] would
40+
files "Changes to be committed", as linkgit:git-status[1] would
4141
put it.
4242

4343
--hard::
@@ -176,6 +176,23 @@ $ git reset <3>
176176
committed as 'snapshot WIP'. This updates the index to show your
177177
WIP files as uncommitted.
178178

179+
Reset a single file in the index::
180+
+
181+
Suppose you have added a file to your index, but later decide you do not
182+
want to add it to your commit. You can remove the file from the index
183+
while keeping your changes with git reset.
184+
+
185+
------------
186+
$ git reset -- frotz.c <1>
187+
$ git commit -m "Commit files in index" <2>
188+
$ git add frotz.c <3>
189+
------------
190+
+
191+
<1> This removes the file from the index while keeping it in the working
192+
directory.
193+
<2> This commits all other changes in the index.
194+
<3> Adds the file to the index again.
195+
179196
Author
180197
------
181198
Written by Junio C Hamano <junkio@cox.net> and Linus Torvalds <torvalds@osdl.org>

0 commit comments

Comments
 (0)