On 29/12/2013 08:16, Cox, Michael wrote:
On Sat, Dec 28, 2013 at 11:39 PM, Edward Diener
wrote: I am interested in this. Other than the hard reset, which tells git to overwrite the working directory and index, I did not think that git would ever throw away uncomitted changes, whether they are in the working directory or the index. Would you please be specific about any situations where git will overwrite the working directory/index without the user being aware ? Just about any git command with a (-f | --force) option, e.g.
git checkout -f HEAD git submodule update -f etc.
Anytime you use a -f option you're telling git, "I know what I'm doing", whether that's true or not. The only one that goes against this is: git checkout my_modified_file which doesn't require a "-f", and overwrites your local modified file (without warning) with the version that is in the repository.
Ok, so that was only a single file lost... but: git checkout . does that to the whole directory, and, of course, is completely different to: git checkout which doesn't do anything harmful. Phil