On Wed, 2014-06-04 at 11:23 +0200, Pierre-François CLEMENT wrote:
>         Beware, though.  I don't have my Git reference to hand, but
>         I've noted that if the file is in the index, it is
>         "tracked" [...]

> Really? Sounds a bit strange. I feel like "tracked files" are
> committed files, and that staged files are "about-to-be-tracked files"

I'm no expert on Git but I think you're looking at it wrong.  What's
below is my understanding:

A tracked file is a file that Git knows about.  An untracked file is a
file Git doesn't know about.  More concretely, any file that has ever
been "git add"'d is tracked.  Files that have never been "git add"'d are
not tracked.  That means files that are committed and unmodified, files
that are staged (whether they've previously been committed or not), and
files that have been committed or staged and are now modified are all
tracked files.

Given these states a file can be in:

     1. committed
     2. staged change to a previous committed file
     3. modified version of previously committed file
     4. staged new file that's never been committed
     5. untracked file

The first four are tracked.  I think "git reset --hard" currently does
the right thing  for the first 3--it's defined to throw away
modifications (#3) and people WANT it to do that much of the time, so
there's no way that behavior could be changed IMO.  Possibly it could
save the modifications to backup files, or require a force option and
without it suggest you stash modified files, or whatever.

You may have an argument about #4.  I personally think it would be
reasonable to have "git reset --hard" turn staged files that are new
back into untracked files, rather than just deleting them.

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