This is the companion of "git switch" [1] and is based on that topic. This command peforms the "checkout paths" from git-checkout, git-reset and also has a third mode to reset only worktree, leaving the index alone. For new people not aware of previous discussions, this command is supposed to be a friendlier replacement for "git checkout" and hopefully fixes some warts that have grown over the time in git-checkout. For this reason, the last patch starts to recommend "git restore" everywhere. For old people, I'm surprised nobody reacts to the command rename from restore-files to restore. "restore" vs "reset" is certainly confusing. My hope was to remove "common porcelain" status from reset, but I probably will not succeed in doing that. Some open issues from the last discussion [2] - intent-to-add support. This will come but maybe later. - --index has a different meaning in git-apply. I don't have a good suggestion except "yeah we have two different worlds now, the old and the new one" The series is also available at [3] [1] https://public-inbox.org/git/20190308095752.8574-1-pclouds@xxxxxxxxx [2] https://public-inbox.org/git/CACsJy8CQhWeC3b6eGPePuRejfOx7c17X61-wqq5kOiRzYkRESw@xxxxxxxxxxxxxx/ [3] https://gitlab.com/pclouds/git/tree/switch-and-restore Nguyễn Thái Ngọc Duy (11): checkout: split part of it to new command 'restore' restore: take tree-ish from --source option instead restore: make pathspec mandatory restore: disable overlay mode by default checkout: factor out worktree checkout code restore: add --worktree and --index restore: default to --source=HEAD when only --index is specified restore: support --patch t: add tests for restore completion: support restore doc: promote "git restore" .gitignore | 1 + Documentation/config/interactive.txt | 3 +- Documentation/git-checkout.txt | 1 + Documentation/git-clean.txt | 2 +- Documentation/git-commit.txt | 4 +- Documentation/git-format-patch.txt | 2 +- Documentation/git-reset.txt | 6 +- Documentation/git-restore.txt (new) | 172 ++++++++++++++++ Documentation/git-revert.txt | 4 +- Documentation/gitcli.txt | 4 +- Documentation/giteveryday.txt | 4 +- Documentation/gittutorial-2.txt | 4 +- Documentation/gittutorial.txt | 2 +- Documentation/user-manual.txt | 14 +- Makefile | 1 + builtin.h | 1 + builtin/checkout.c | 259 +++++++++++++++++++------ builtin/clone.c | 2 +- builtin/commit.c | 2 +- command-list.txt | 3 +- contrib/completion/git-completion.bash | 15 ++ git-add--interactive.perl | 52 +++++ git.c | 1 + t/lib-patch-mode.sh | 12 ++ t/t2070-restore.sh (new +x) | 77 ++++++++ t/t2071-restore-patch.sh (new +x) | 105 ++++++++++ t/t7508-status.sh | 82 ++++---- t/t7512-status-help.sh | 20 +- wt-status.c | 26 ++- 29 files changed, 736 insertions(+), 145 deletions(-) create mode 100644 Documentation/git-restore.txt create mode 100755 t/t2070-restore.sh create mode 100755 t/t2071-restore-patch.sh -- 2.21.0.rc1.337.gdf7f8d0522