From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-Status: No, score=-3.7 required=3.0 tests=AWL,BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_PASS, SPF_PASS shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by dcvr.yhbt.net (Postfix) with ESMTP id 455171F5AE for ; Sat, 13 Jun 2020 14:25:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726280AbgFMOZ3 (ORCPT ); Sat, 13 Jun 2020 10:25:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49140 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726102AbgFMOZ2 (ORCPT ); Sat, 13 Jun 2020 10:25:28 -0400 Received: from mail-qk1-x743.google.com (mail-qk1-x743.google.com [IPv6:2607:f8b0:4864:20::743]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 030F7C03E96F for ; Sat, 13 Jun 2020 07:25:27 -0700 (PDT) Received: by mail-qk1-x743.google.com with SMTP id q8so11712662qkm.12 for ; Sat, 13 Jun 2020 07:25:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:mime-version :content-transfer-encoding; bh=DghuTSbX4zxMdv4AE3Dx+fuWr8PHfn3QrPhRR6s/d90=; b=MjMahsNOYe7zBv9b+B9wv5ai/L7G04tOjuqnjuDR9VyQBPmP026INHWb2Nb6ui1xSh VC4iXiJT6F76Ma3IGs4QnO4tfx9bK+5SiTkiY/wPFsk01yL0XL4MIfuCMAsaLmNgTnJg V09ZbY9b/hlCJD7PieVYFTvwkSELuS8rneBjWmqtXVdqDy/yxnTM7G+DvG70hTT/b8/y G44tfkgFX+gOqDgJALMDGBDTw3msKe3FeuUrqtxrRKrIRTxcye+/tgasLdCw43HFyFcT f3gqmpwKfdYerFpaIB2ZBDYWEigUnSWM8dXydaskDdVWkTewnbhdyHtpThZmHkte4M93 lpYg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:mime-version :content-transfer-encoding; bh=DghuTSbX4zxMdv4AE3Dx+fuWr8PHfn3QrPhRR6s/d90=; b=K9ElpxE+hhSimYO8/N7jYyS0YDM1IYH9CnR4TWCXho8SswiozJyOnjGEUfCH+++Yqf znbpY41osaEwsZMlnpNQ4XcBYaE/VckhiefVf7UT3ZmmX5ndyrykZWNWNxb1q9zcfnoG JG/BO+YVaSOL0MXDsFiAQIXqtJ5YFqsvrgGqbgDmYqlvTGLgEBYUlNmHVmOpQdBA7w60 kqYngYLrqDrJaKgRuCdel2y6k5WdDhfk5HiMVsqSUjBZj5Oyl6u/U8QiuhztDG3T6rLc DXsdnsvrQ3Sq0BwcOROESdM5qJH/mf7liq9L9Hb2tcN80lkyQGOmEAvl3py+tCQ6w5R8 3ggA== X-Gm-Message-State: AOAM5317Kd2AFZkSst3Xi+T3SO6AL2Ss3toywwsfoBuXbzOCnD1+QXBP IDanYxPMb/EBi/mDBmjBOp1uy2QKAWU= X-Google-Smtp-Source: ABdhPJzTfktEqtWlPPpbv9lZJ8wmKYZ4nU7ijdTUET3CN3N0W1EgmWMdnP5R5zG/FgaqzVfgyhNrQQ== X-Received: by 2002:a37:a648:: with SMTP id p69mr7842561qke.190.1592058326747; Sat, 13 Jun 2020 07:25:26 -0700 (PDT) Received: from archbookpro.localdomain (CPE18593399858a-CM185933998587.cpe.net.cable.rogers.com. [174.112.65.113]) by smtp.gmail.com with ESMTPSA id x36sm7144232qtd.97.2020.06.13.07.25.25 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 13 Jun 2020 07:25:26 -0700 (PDT) From: Denton Liu To: Git Mailing List Subject: [PATCH] checkout: teach --worktree Date: Sat, 13 Jun 2020 10:25:12 -0400 Message-Id: X-Mailer: git-send-email 2.27.0.132.g321788e831 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org 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=