git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: Resetting working files

From
PBPeter Baumann <waste.manager@gmx.de>
Date
May 31, 2009, 16:25 UTC
Message-ID
<20090531162515.GB8129@m62s10.vlinux.de>
In-Reply-To
<4A229B9A.6060807@dirk.my1.cc>
On Sun, May 31, 2009 at 05:00:42PM +0200, Dirk Süsserott wrote:
Show 9 quoted lines
> Am 31.05.2009 15:09 schrieb Aaron Gray:
>> Hi,
>>
>> How do I reset the working files back to HEAD ?
>>
>> Many thanks,
>>
>> Aaron
>>
[...]
> To revert only a single file, use
>
> $ git checkout -- path/to/file
>

This will only reset the file content to the version in the index. E.g.

	echo modified >> a.txt
	git add a.txt
	git checkout -- a.txt           (1)
	git checkout HEAD -- a.txt	(2)
(1) This will do nothing to your file 'a.txt' in your workdir because
    the index and the workdir are identical
(2) This will reset your file to the state before you run that bogus
    echo modified >> a.txt   comand

Greetings, Peter

Previous: Aaron GrayNext: Aaron Gray
Message 4 of 8 in “Resetting working files”
  1. Aaron GrayMay 31, 2009
  2. Dirk SüsserottMay 31, 2009
  3. Aaron GrayMay 31, 2009
  4. Peter BaumannMay 31, 2009
  5. Aaron GrayMay 31, 2009
  6. Nicolas SebrechtMay 31, 2009
  7. Aaron GrayMay 31, 2009
  8. Alex RiesenMay 31, 2009

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.