File tree Expand file tree Collapse file tree 1 file changed +17
-0
lines changed
Expand file tree Collapse file tree 1 file changed +17
-0
lines changed Original file line number Diff line number Diff 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+
179196Author
180197------
181198Written by Junio C Hamano <junkio@cox.net> and Linus Torvalds <torvalds@osdl.org>
You can’t perform that action at this time.
0 commit comments