From: Denton Liu Date: Sat, 13 Jun 2020 14:25:12 GMT Subject: [PATCH] checkout: teach --worktree Message-ID: A complaint that has come up frequently in the past is that it is not possible to checkout files directly into a worktree without modifying the index. Even though this could be worked around by redirecting the output of `git show` to overwrite files, this was not feasible if one wanted to use patch mode. Since `git restore` was implemented, this has since been possible using the `--worktree` option. However, some long-time users of Git still prefer to use `git checkout` over `git restore` and would like to see the functionality ported over. Teach `git checkout --worktree`, allowing users to checkout files directly into the worktree without affecting the index. Signed-off-by: Denton Liu --- Documentation/git-checkout.txt | 22 ++++++++++----- builtin/checkout.c | 17 ++++++++++++ t/t2028-checkout-worktree.sh | 51 ++++++++++++++++++++++++++++++++++ t/t9902-completion.sh | 1 + 4 files changed, 84 insertions(+), 7 deletions(-) create mode 100755 t/t2028-checkout-worktree.sh diff --git a/Documentation/git-checkout.txt b/Documentation/git-checkout.txt index 5b697eee1b..ba9c0a900c 100644 --- a/Documentation/git-checkout.txt +++ b/Documentation/git-checkout.txt @@ -12,9 +12,9 @@ SYNOPSIS 'git checkout' [-q] [-f] [-m] --detach [] 'git checkout' [-q] [-f] [-m] [--detach] 'git checkout' [-q] [-f] [-m] [[-b|-B|--orphan] ] [] -'git checkout' [-f|--ours|--theirs|-m|--conflict=