Resetting working files

4 messages, 3 authors, 2016-06-15 · open the first message on its own page

Resetting working files

From: Aaron Gray <hidden>
Date: 2016-06-15 22:46:53

Hi,

How do I reset the working files back to HEAD ?

Many thanks,

Aaron

Re: Resetting working files

From: Dirk Süsserott <hidden>
Date: 2016-06-15 22:46:53

Am 31.05.2009 15:09 schrieb Aaron Gray:
Hi,

How do I reset the working files back to HEAD ?

Many thanks,

Aaron
$ git reset --hard

This will revert all changes you made in your working tree back to the 
HEAD. It will delete your changes made so far. To revert only a single 
file, use

$ git checkout -- path/to/file

Re: Resetting working files

From: Aaron Gray <hidden>
Date: 2016-06-15 22:46:53

Am 31.05.2009 15:09 schrieb Aaron Gray:
quoted
Hi,

How do I reset the working files back to HEAD ?

Many thanks,

Aaron
$ git reset --hard

This will revert all changes you made in your working tree back to the 
HEAD. It will delete your changes made so far. To revert only a single 
file, use

$ git checkout -- path/to/file
Great thanks alot Dirk, you anticipated my second question too :)

Cheers,

Aaron

Re: Resetting working files

From: Peter Baumann <hidden>
Date: 2016-06-15 22:46:53

On Sun, May 31, 2009 at 05:00:42PM +0200, Dirk Süsserott wrote:
Am 31.05.2009 15:09 schrieb Aaron Gray:
quoted
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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help