> From: André Hänsel <an...@webkr.de>

> As usual I made sure that I had 
> no uncommited changes. There were only a few untracked files laying around 
> and my untracked (so I thought) but staged file, so I felt safe to reset. I 
> was expecting to see my migration file as untracked afterwards, ready to be 
> staged again.

Ah, an interesting gotcha!  Since you'd staged the file, it was
tracked, and thus it was vulnerable to git-reset--hard.  (I've got in
my notes, "A file is tracked if it is in the base commit of the
repository or if it is in the index.")

> From: "Philip Oakley" <philipoak...@iee.org>
>  
> An alternative question would be, "Could the man page be improved so
> that what you ned was spotted sooner?". 

In the manual page:

           --hard
               Resets the index and working tree. Any changes to tracked files
               in the working tree since <commit> are discarded.

it might be useful to add "Beware that files that have been staged
(added) but never committed are tracked and so will be discarded."

Dale

-- 
You received this message because you are subscribed to the Google Groups "Git 
for human beings" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to git-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to