This is the first half of the previous "switch-branch and restore-files" RFC series [1]. I only focus on switch-branch for now because it's already getting long and I still have some work to do on restore-files. The command is, as the name implies, for switching branches. And it's supposed to be a (hopefully better) alternative for "git checkout". Head to 08/19 for the man page, which describes the command (with examples!) better than I do here. I think I've addressed most of the issues from the last round. The only one left is adding options similar to "git reset" (but with better names this time than --soft and --hard, hopefully). I think that could be done in a follow-up series. For a complete picture, you would need to consider "git restore" too (the new name of "git restore-files"). Full series is available [2] though I still need to work on the "restore from a tree" part of that command and thinking whether "restore -p" vs "reset -p" could be confusing... This series is built on top of master + tg/checkout-no-overlay. PS. One of the things I like about this, after using it for some time, is the "no ambiguation" UI design gives better completion support (much less useless completion candidates), which makes life much better. [1] https://public-inbox.org/git/20181129215850.7278-1-pclouds@xxxxxxxxx/ [2] https://gitlab.com/pclouds/git/commits/switch-and-restore Nguyễn Thái Ngọc Duy (19): git-checkout.txt: fix one syntax line doc: document --overwrite-ignore t: rename t2014-switch.sh to t2014-checkout-switch.sh checkout: factor out some code in parse_branchname_arg() checkout: make "opts" in cmd_checkout() a pointer checkout: move 'confict_style' and 'dwim_..' to checkout_opts checkout: split options[] array in three pieces checkout: split part of it to new command switch switch: better names for -b and -B switch: remove -l switch: stop accepting pathspec switch: reject "do nothing" case switch: only allow explicit detached HEAD switch: add short option for --detach switch: no implicit dwim, use --guess to dwim switch: no worktree status unless real branch switch happens t: add tests for switch completion: support switch doc: promote "git switch" .gitignore | 1 + Documentation/config/advice.txt | 13 +- Documentation/config/branch.txt | 4 +- Documentation/config/checkout.txt | 17 +- Documentation/config/diff.txt | 3 +- Documentation/git-branch.txt | 8 +- Documentation/git-check-ref-format.txt | 3 +- Documentation/git-checkout.txt | 48 +- Documentation/git-format-patch.txt | 2 +- Documentation/git-merge-base.txt | 2 +- Documentation/git-merge.txt | 4 + Documentation/git-rebase.txt | 2 +- Documentation/git-remote.txt | 2 +- Documentation/git-rerere.txt | 10 +- Documentation/git-reset.txt | 20 +- Documentation/git-stash.txt | 9 +- Documentation/git-switch.txt | 236 +++++++++ Documentation/gitattributes.txt | 3 +- Documentation/gitcore-tutorial.txt | 18 +- Documentation/giteveryday.txt | 24 +- Documentation/githooks.txt | 8 +- Documentation/gittutorial.txt | 4 +- Documentation/revisions.txt | 2 +- Documentation/user-manual.txt | 52 +- Makefile | 1 + advice.c | 11 +- builtin.h | 1 + builtin/checkout.c | 464 +++++++++--------- builtin/clone.c | 2 +- command-list.txt | 1 + contrib/completion/git-completion.bash | 26 + git.c | 1 + parse-options-cb.c | 17 + parse-options.h | 3 +- sha1-name.c | 2 +- t/t1090-sparse-checkout-scope.sh | 14 - ...014-switch.sh => t2014-checkout-switch.sh} | 0 t/t2020-checkout-detach.sh | 4 +- t/t2060-switch.sh | 91 ++++ 39 files changed, 770 insertions(+), 363 deletions(-) create mode 100644 Documentation/git-switch.txt rename t/{t2014-switch.sh => t2014-checkout-switch.sh} (100%) create mode 100755 t/t2060-switch.sh -- 2.20.1.682.gd5861c6d90