Junio C Hamano <gitster@xxxxxxxxx> writes: > "Shawn O. Pearce" <spearce@xxxxxxxxxxx> writes: > >>> I realize I can also do >>> >>> $ git reset HEAD file >>> $ git checkout file >> >> All of those also work, but as you said, are less fun to type. :-) > > And why not "git checkout HEAD file" as the user manual teaches > you to? I don't see any mention of "git checkout HEAD" in the user manual. There's this: Checking out an old version of a file [...] $ git checkout HEAD^ path/to/file But "Checking out an old version of a file" is not the place one should search for this, and since "git checkout path/to/file" is also correct, it seemed to me to be the natural adaptation of the command (and it actually doesn't do exactly the same thing). I'd suggest something like the patch below to make it clear in the user-manual. Still, I think "git reset --hard HEAD file1 file2" should be made equivalent to "git checkout HEAD file1 file2", since "reset" is really what you want to do with these files, and I believe it is the first command a beginner (at least me ;-) ) will try to use in this case. Having two different commands to reset a few files or the whole tree is a bit weird. >From 35f8e7eafd42540014ab87a5ca3bb1dd8e0a03ca Mon Sep 17 00:00:00 2001 From: Matthieu Moy <Matthieu.Moy@xxxxxxx> Date: Mon, 10 Sep 2007 08:14:08 +0200 Subject: [PATCH] Mention "git checkout HEAD file" in user-manual in "fixing mistake" part. Signed-off-by: Matthieu Moy <Matthieu.Moy@xxxxxxx> --- Documentation/user-manual.txt | 6 ++++++ 1 files changed, 6 insertions(+), 0 deletions(-) diff --git a/Documentation/user-manual.txt b/Documentation/user-manual.txt index 35298e6..5b883ed 100644 --- a/Documentation/user-manual.txt +++ b/Documentation/user-manual.txt @@ -1358,6 +1358,12 @@ state with $ git reset --hard HEAD ------------------------------------------------- +Alternatively, you can revert individual files with + +------------------------------------------------- +$ git checkout HEAD path/to/a/file another/file +------------------------------------------------- + If you make a commit that you later wish you hadn't, there are two fundamentally different ways to fix the problem: -- 1.5.3.1.20.gb250f -- Matthieu - To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html