From: Julia Evans via GitGitGadget Date: Fri, 29 Aug 2025 11:45:31 GMT Subject: [PATCH v2 2/5] doc: git-checkout: clarify `git checkout ` Message-ID: <23a738981abd2073c70bbb5dd36eea050065e643.1756467934.git.gitgitgadget@gmail.com> In-Reply-To: From: Julia Evans - "To prepare for working on __..." is confusing to some users: it makes it sound like these are steps that the user has to do, not steps that Git itself will do. Reword it. - Use "changes" instead of "modifications" (which Git normally does) - Mention that `git checkout` will fail if there's a merge conflict - The current explanation of `You could omit `... is confusing to users (what are the "expensive side effects"? what's a better way of getting the same info?). Be more direct and mention that `git status` is likely a better option. Signed-off-by: Julia Evans --- Documentation/git-checkout.adoc | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/Documentation/git-checkout.adoc b/Documentation/git-checkout.adoc index c86941ad53..4de3ac6680 100644 --- a/Documentation/git-checkout.adoc +++ b/Documentation/git-checkout.adoc @@ -28,11 +28,11 @@ DESCRIPTION See ARGUMENT DISAMBIGUATION below for how Git decides which one to do. `git checkout []`:: - To prepare for working on __, switch to it by updating - the index and the files in the working tree, and by pointing - `HEAD` at the branch. Local modifications to the files in the - working tree are kept, so that they can be committed to the - __. + Switch to __. This sets the current branch to and + updates the files in your working directory. Local changes to + the files in the working tree are kept, so that they can be committed + to the __. If the local changes can't be cleanly merged into + the __, no changes will be made and the checkout operation will fail. + If __ is not found but there does exist a tracking branch in exactly one remote (call it __) with a matching name and @@ -42,10 +42,8 @@ exactly one remote (call it __) with a matching name and $ git checkout -b --track / ------------ + -You could omit __, in which case the command degenerates to -"check out the current branch", which is a glorified no-op with -rather expensive side-effects to show only the tracking information, -if it exists, for the current branch. +Running `git checkout` without specifying a branch has no effect except +to print out the tracking information for the current branch. `git checkout (-b|-B) []`:: -- gitgitgadget