From ce8936c342a15a08029c71fdc92e283e3624bc18 Mon Sep 17 00:00:00 2001 From: Matthieu Moy Date: Mon, 6 Apr 2009 22:45:21 +0200 Subject: git-checkout.txt: fix incorrect statement about HEAD and index The command "git checkout" checks out from the index by default, not HEAD (the introducing comment were correct, but the detailled explanation added below were not). Signed-off-by: Matthieu Moy Signed-off-by: Junio C Hamano diff --git a/Documentation/git-checkout.txt b/Documentation/git-checkout.txt index 5aa69c0..8830479 100644 --- a/Documentation/git-checkout.txt +++ b/Documentation/git-checkout.txt @@ -145,8 +145,8 @@ $ git checkout hello.c <3> ------------ + <1> switch branch -<2> take out a file out of other commit -<3> restore hello.c from HEAD of current branch +<2> take a file out of another commit +<3> restore hello.c from the index + If you have an unfortunate branch that is named `hello.c`, this step would be confused as an instruction to switch to that branch. -- cgit v0.10.2-6-g49f6 From 39470cf961e584ddb505f51bb9c452ebcfd5c569 Mon Sep 17 00:00:00 2001 From: Matthieu Moy Date: Tue, 7 Apr 2009 14:43:53 +0200 Subject: git-checkout.txt: clarify that applies when no path is given. Otherwise, the sentence "Defaults to HEAD." can be mis-read to mean that "git checkout -- hello.c" checks-out from HEAD. Signed-off-by: Matthieu Moy Signed-off-by: Junio C Hamano diff --git a/Documentation/git-checkout.txt b/Documentation/git-checkout.txt index 8830479..19510de 100644 --- a/Documentation/git-checkout.txt +++ b/Documentation/git-checkout.txt @@ -85,9 +85,13 @@ should result in deletion of the path). :: Name for the new branch. +:: + Tree to checkout from (when paths are given). If not specified, + the index will be used. + :: - Branch to checkout; may be any object ID that resolves to a - commit. Defaults to HEAD. + Branch to checkout (when no paths are given); may be any object + ID that resolves to a commit. Defaults to HEAD. + When this parameter names a non-branch (but still a valid commit object), your HEAD becomes 'detached'. -- cgit v0.10.2-6-g49f6 From 20ff3ec28e1dc7b653bfdc7643cb55045d7913fc Mon Sep 17 00:00:00 2001 From: Jason Merrill Date: Mon, 6 Apr 2009 11:03:36 -0400 Subject: Documentation: clarify .gitattributes search Use the term "toplevel of the work tree" in gitattributes.txt and gitignore.txt to define the limits of the search for those files. Signed-off-by: Jason Merrill Signed-off-by: Junio C Hamano diff --git a/Documentation/gitattributes.txt b/Documentation/gitattributes.txt index 37fff20..c4aebc4 100644 --- a/Documentation/gitattributes.txt +++ b/Documentation/gitattributes.txt @@ -59,9 +59,9 @@ attribute. When deciding what attributes are assigned to a path, git consults `$GIT_DIR/info/attributes` file (which has the highest precedence), `.gitattributes` file in the same directory as the -path in question, and its parent directories (the further the -directory that contains `.gitattributes` is from the path in -question, the lower its precedence). +path in question, and its parent directories up to the toplevel of the +work tree (the further the directory that contains `.gitattributes` +is from the path in question, the lower its precedence). If you wish to affect only a single repository (i.e., to assign attributes to files that are particular to one user's workflow), then diff --git a/Documentation/gitignore.txt b/Documentation/gitignore.txt index 59321a2..7df3cef 100644 --- a/Documentation/gitignore.txt +++ b/Documentation/gitignore.txt @@ -31,8 +31,8 @@ precedence, the last matching pattern decides the outcome): * Patterns read from a `.gitignore` file in the same directory as the path, or in any parent directory, with patterns in the - higher level files (up to the root) being overridden by those in - lower level files down to the directory containing the file. + higher level files (up to the toplevel of the work tree) being overridden + by those in lower level files down to the directory containing the file. These patterns match relative to the location of the `.gitignore` file. A project normally includes such `.gitignore` files in its repository, containing patterns for -- cgit v0.10.2-6-g49f6 From 714fddf2fc50cd5abb11d75837e6340edb9601f6 Mon Sep 17 00:00:00 2001 From: Jari Aalto Date: Sat, 21 Mar 2009 11:00:54 +0200 Subject: Change double quotes to single quotes in message Most of the time when we give branch name in the message, we quote it inside a pair of single-quotes. git-checkout uses double-quotes; this patch corrects the inconsistency. Signed-off-by: Jari Aalto Signed-off-by: Junio C Hamano diff --git a/builtin-checkout.c b/builtin-checkout.c index 20b34ce..ed0f318 100644 --- a/builtin-checkout.c +++ b/builtin-checkout.c @@ -501,10 +501,10 @@ static void update_refs_for_switch(struct checkout_opts *opts, create_symref("HEAD", new->path, msg.buf); if (!opts->quiet) { if (old->path && !strcmp(new->path, old->path)) - fprintf(stderr, "Already on \"%s\"\n", + fprintf(stderr, "Already on '%s'\n", new->name); else - fprintf(stderr, "Switched to%s branch \"%s\"\n", + fprintf(stderr, "Switched to%s branch '%s'\n", opts->new_branch ? " a new" : "", new->name); } @@ -513,7 +513,7 @@ static void update_refs_for_switch(struct checkout_opts *opts, REF_NODEREF, DIE_ON_ERR); if (!opts->quiet) { if (old->path) - fprintf(stderr, "Note: moving to \"%s\" which isn't a local branch\nIf you want to create a new branch from this checkout, you may do so\n(now or later) by using -b with the checkout command again. Example:\n git checkout -b \n", new->name); + fprintf(stderr, "Note: moving to '%s' which isn't a local branch\nIf you want to create a new branch from this checkout, you may do so\n(now or later) by using -b with the checkout command again. Example:\n git checkout -b \n", new->name); describe_detached_head("HEAD is now at", new->commit); } } diff --git a/t/t7201-co.sh b/t/t7201-co.sh index 0e21632..bdb808a 100755 --- a/t/t7201-co.sh +++ b/t/t7201-co.sh @@ -171,7 +171,7 @@ test_expect_success 'checkout to detach HEAD' ' git checkout -f renamer && git clean -f && git checkout renamer^ 2>messages && (cat >messages.expect < -- cgit v0.10.2-6-g49f6