summaryrefslogtreecommitdiff
path: root/templates
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2017-04-27 09:32:19 +0900
committerJunio C Hamano <gitster@pobox.com>2017-04-27 09:32:19 +0900
commitaf827b63f8c2886725683f1f538a4163beb046dd (patch)
tree4b28ae12901cd3bdcd10fa4d6d75d9baa4811003 /templates
parent49800c940790cc7465d1b03e08d472ffd8684808 (diff)
downloadgit-jc/checkout-working-tree-only.tar.gz
checkout: add --working-tree-only optionjc/checkout-working-tree-only
"git checkout <tree-ish> <pathspec>" 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 <tree-ish> <pathspec>" would have done the same as "git reset <tree-ish> <pathspec>" 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 <gitster@pobox.com>
Diffstat (limited to 'templates')
0 files changed, 0 insertions, 0 deletions