From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: AS31976 209.132.180.0/23 X-Spam-Status: No, score=-2.7 required=3.0 tests=AWL,BAYES_00,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,RCVD_IN_DNSWL_HI,RCVD_IN_SORBS_SPAM, RP_MATCHES_RCVD,T_DKIM_INVALID shortcircuit=no autolearn=no autolearn_force=no version=3.4.0 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by dcvr.yhbt.net (Postfix) with ESMTP id CC8F8207E4 for ; Wed, 26 Apr 2017 02:51:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1953677AbdDZCvX (ORCPT ); Tue, 25 Apr 2017 22:51:23 -0400 Received: from mail-pg0-f66.google.com ([74.125.83.66]:34040 "EHLO mail-pg0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1953557AbdDZCvV (ORCPT ); Tue, 25 Apr 2017 22:51:21 -0400 Received: by mail-pg0-f66.google.com with SMTP id t7so11059326pgt.1 for ; Tue, 25 Apr 2017 19:51:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version; bh=V1yVvvxZ2kzvmLbO/tzCAJ2JcrhyA2vyEdUCx9nQapM=; b=YqtptMJlK+rp7F+rPMmmna9zwChekF3dVvOj6ABMdIKllpwEwejitqxbCl7gKCVx7N NnJsje5XJ1MNQ2QDCsB38rWzXFYy4cTqEHTiyAQ5u+3U+nrKFfX5SVHXmdChwgW4+2DK RIN+RqZ5gJRsO6O559lUzW2LIfvn/aMJXjYg5k+yMyIJCcqrHlo0UhtKa7Rj90FlcFVX LrC4VL4yE5aBo7Am/VF3sxxWQtLRB29qtp96NUDRS1ZNN4x0RQs6DjBc96WVqGLKyiGR ZaEmaO1UM7kwmff51J2BBiWNR/0r07+NYvzkZLziuntyM+uYBl9gRWlH6+mCe/sxEg3i iqRA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:references:date :in-reply-to:message-id:user-agent:mime-version; bh=V1yVvvxZ2kzvmLbO/tzCAJ2JcrhyA2vyEdUCx9nQapM=; b=m8q759jOMhioDxfAZlOWDLI4Ig+hCtCxVm/DeqT9QGzpOdhcv1Rdd92orGmdj3M+vR T5RRT0TOVCEpnUIVEpt+NehSCCF9oaN46p7BJqdFBJaviEteMhFTVAgRq3l09QUp0C6X RIDBmmsOrtYhrA/rczB+wy50lqzavIRB/BTRLB6U8UaeLxYkUqGzw7DADTFUYuyBIvLp jrBi4mEV7A6+MbXwDIIwsH/wNYmglFVRNlGkZ/5M1k3y1+EfK+KqF5M4IsG2CSqTKKFH L7Bzn2oVe+cP1Q7BoaJrnSWbd/Uo05mndJbDfTCKOXWMKOgSBudDxemsvucbebifcnFI 6H1g== X-Gm-Message-State: AN3rC/7xvqT9YMtt7YxJR62KCBC5lMKFPAChHqb/7TgpxvW57DzaYLuk zi1/QD4rgasf1g== X-Received: by 10.98.144.155 with SMTP id q27mr30185390pfk.179.1493175080529; Tue, 25 Apr 2017 19:51:20 -0700 (PDT) Received: from localhost ([2620:0:1000:8622:3179:d004:20b:b383]) by smtp.gmail.com with ESMTPSA id u23sm38735205pfd.63.2017.04.25.19.51.19 (version=TLS1_2 cipher=AES128-SHA bits=128/128); Tue, 25 Apr 2017 19:51:19 -0700 (PDT) From: Junio C Hamano To: "Philip Oakley" Cc: "Stefan Beller" , "Jeff King" , "Orgad Shaneh" , "Dakota Hawkins" , "git" , "Christoph Michelbach" Subject: Re: Submodule/contents conflict References: <4BF0A1BFFFFD421EB8C5F7E6FEF14357@PhilipOakley> Date: Tue, 25 Apr 2017 19:51:19 -0700 In-Reply-To: (Philip Oakley's message of "Tue, 25 Apr 2017 12:10:01 +0100") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1.91 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org "Philip Oakley" writes: > As I recall Christoph was using checkout to copy a file (e.g. a > template file) from an older commit/revision into his worktree, and > was suprised that this (git checkout ) also _staged_ the > file, rather than simply letting it be in a modified/untracked state. This probably is taking it even further than the original topic, but I raise this weather-balloon to see if anybody is interested. In the modern day, it might be useful if the "--working-tree-only" mode added a new file as an intent-to-add entry to the index, but that is not what "git apply (no other options)" (which is the gold standard for command that operates on the working tree and/or on the index) does, so it is not done in this patch. IOW, if you grab a path that does not exist in your index out of , you will write out an untracked file to the working tree. -- >8 -- Subject: [PATCH] checkout: add --working-tree-only option "git checkout " has always copied the blob from the tree-ish to the index before checking them out to the working tree. Some users may want to grab a blob out of a tree-ish directly to the working tree, without updating the index, so that "git diff" can be used to assess the damage and adjust the file contents taken from a different branch to be more appropriate for the current branch. The new option "--working-tree-only" allows exactly that. In the hindsight, when a command works on the working tree and/or the index, the usual convention is: - with no other option, the command works only on the working tree; - with "--cached" option, the command works only on the index; and - with "--index" option, the command works on both the working tree and the index. So we probably should have triggered the default behaviour under the "--index" option, and triggered this "--working-tree-only" mode of behaviour when "--index" option is not given. From the same point of view, "git checkout --cached " would have done the same as "git reset " would do. And that may have made the command set a bit more consistent. But that is merely a hindsight being 20/20, oh well. Signed-off-by: Junio C Hamano --- Documentation/git-checkout.txt | 22 +++++++++++++++------- builtin/checkout.c | 10 +++++++++- t/t2022-checkout-paths.sh | 21 +++++++++++++++++++++ 3 files changed, 45 insertions(+), 8 deletions(-) diff --git a/Documentation/git-checkout.txt b/Documentation/git-checkout.txt index 8e2c0662dd..201677752e 100644 --- a/Documentation/git-checkout.txt +++ b/Documentation/git-checkout.txt @@ -14,6 +14,7 @@ SYNOPSIS 'git checkout' [-q] [-f] [-m] [[-b|-B|--orphan] ] [] 'git checkout' [-f|--ours|--theirs|-m|--conflict=