summaryrefslogtreecommitdiff
path: root/Documentation/gitcli.txt
diff options
context:
space:
mode:
authorNguyễn Thái Ngọc Duy <pclouds@gmail.com>2019-04-25 09:45:45 (GMT)
committerJunio C Hamano <gitster@pobox.com>2019-05-07 04:04:47 (GMT)
commit46e91b663badd99b3807ab34decfd32f3cbf15e7 (patch)
treed01c087e69f6abe1fde5b3c9e220151b18c802cf /Documentation/gitcli.txt
parent328c6cb853d7237098569de9f94bc3d259846a08 (diff)
downloadgit-46e91b663badd99b3807ab34decfd32f3cbf15e7.zip
git-46e91b663badd99b3807ab34decfd32f3cbf15e7.tar.gz
git-46e91b663badd99b3807ab34decfd32f3cbf15e7.tar.bz2
checkout: split part of it to new command 'restore'
Previously the switching branch business of 'git checkout' becomes a new command 'switch'. This adds the restore command for the checking out paths path. Similar to git-switch, a new man page is added to describe what the command will become. The implementation will be updated shortly to match the man page. A couple main differences from 'git checkout <paths>': - 'restore' by default will only update worktree. This matters more when --source is specified ('checkout <tree> <paths>' updates both worktree and index). - 'restore --staged' can be used to restore the index. This command overlaps with 'git reset <paths>'. - both worktree and index could also be restored at the same time (from a tree) when both --staged and --worktree are specified. This overlaps with 'git checkout <tree> <paths>' - default source for restoring worktree and index is the index and HEAD respectively. A different (tree) source could be specified as with --source (*). - when both index and worktree are restored, --source must be specified since the default source for these two individual targets are different (**) - --no-overlay is enabled by default, if an entry is missing in the source, restoring means deleting the entry (*) I originally went with --from instead of --source. I still think --from is a better name. The short option -f however is already taken by force. And I do think short option is good to have, e.g. to write -s@ or -s@^ instead of --source=HEAD. (**) If you sit down and think about it, moving worktree's source from the index to HEAD makes sense, but nobody is really thinking it through when they type the commands. Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'Documentation/gitcli.txt')
-rw-r--r--Documentation/gitcli.txt12
1 files changed, 12 insertions, 0 deletions
diff --git a/Documentation/gitcli.txt b/Documentation/gitcli.txt
index 592e06d..225513e 100644
--- a/Documentation/gitcli.txt
+++ b/Documentation/gitcli.txt
@@ -209,6 +209,18 @@ See also http://marc.info/?l=git&m=116563135620359 and
http://marc.info/?l=git&m=119150393620273 for further
information.
+Some other commands that also work on files in the working tree and/or
+in the index can take `--staged` and/or `--worktree`.
+
+* `--staged` is exactly like `--cached`, which is used to ask a
+ command to only work on the index, not the working tree.
+
+* `--worktree` is the opposite, to ask a command to work on the
+ working tree only, not the index.
+
+* The two options can be specified together to ask a command to work
+ on both the index and the working tree.
+
GIT
---
Part of the linkgit:git[1] suite