| > Git absolutely cares about files. In a sense. A commit is not a set of files, it is one or more blobs and one or more trees (which may in turn point to one or more blobs or trees.) A blob does refer to a file, both in content and location, but it's the blob that matters. The OP speaks of the files on disk, which Git doesn't copy around. Git does, however, change the state of the working directory to that which matches the trees referenced in the commit. What I don't like about this is that it tries to make it seem like the files on disk matter in a way that they don't from Git's perspective. > I don't understand your objection to this phrasing. I had a chat with a coworker and he agreed that my distaste with the "current branch" terminology is perhaps misplaced. > When used as "git checkout <ref>", this is correct, but that is not what the author is talking about. "git checkout <ref> <file>" or "git checkout -- <file>" does exactly what the author describes, copying files from the given commit or index to the working directory. Of course, the files that are being copied are not the files that the OP is talking about. The files being copied are the trees and blobs, not the files in the working directory. The effective result is the same, but thinking in files on disk will not improve one's knowledge of Git. > Only partly true, but true enough. The commit isn't irretrievably lost, but the reflog falls more under "advanced usage"; certainly a git beginner shouldn't be making detached commits and relying on the reflog to get back to them. Shunning the reflog doesn't do anyone any good. The OP not even mentioning the reflog is in poor taste, and makes the statement in the guide untrue. I did a bit of research into the reflog after some questions arose and should update my prior comment about it to say: Any commit that Git determines to be unreachable (a list of which that you can see with `git fsck --unreachable`) will only be removed from the reflog after both the reflog's unreachable expiration time has passed (by default, 30 days for unreachable) and `git gc` has ran. At the very least, without mentioning the reflog, the OP should state that unreachable commits will remain for 30 days. |