Skip to content

Commit 965053b

Browse files
pietergitster
authored andcommitted
Documentation/git-reset: Add an example of resetting selected paths
Signed-off-by: Pieter de Bie <pdebie@ai.rug.nl> Signed-off-by: Junio C Hamano <gitster@pobox.com>
1 parent ceb4cac commit 965053b

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

Documentation/git-reset.txt

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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)