Introduce new commands switch-branch and restore-files
Get series with b4
b4 am [email protected]Versions newest first · linked by author and title
- v3 Latest14 patches 33 repliesIn review
- v27 patches 31 repliesSuperseded
Patches in v3 No applies recorded yet
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/14 | git-checkout.txt: fix one syntax lineDocumentation/ | +1 | 0 replies | |
| 2/14 | git-checkout.txt: split detached head section outDocumentation/ Documentation/ | +133 | 0 replies | |
| 3/14 | checkout: factor out some code in parse_branchname_arg()builtin/ | +31 | 0 replies | |
| 4/14 | checkout: make "opts" in cmd_checkout() a pointerbuiltin/ | +55 | 0 replies | |
| 5/14 | checkout: move 'confict_style' and 'dwim_..' to checkout_optsbuiltin/ | +9 | 0 replies | |
| 6/14 | checkout: split options[] array in three piecesbuiltin/ parse-options-cb.c parse-options.h | +73 | 0 replies | |
| 7/14 | checkout: split into switch-branch and restore-files.gitignore Documentation/ Documentation/ +6 more | +543 | 10 replies | |
| 8/14 | switch-branch: better names for -b and -Bbuiltin/ | +19 | 0 replies | |
| 9/14 | switch-branch: stop accepting pathspecbuiltin/ | +12 | 0 replies | |
| 10/14 | switch-branch: reject "do nothing" casebuiltin/ | +10 | 0 replies | |
| 11/14 | switch-branch: only allow explicit detached HEADbuiltin/ | +10 | 2 replies | |
| 12/14 | restore-files: take tree-ish from --from option insteadbuiltin/ | +34 | 0 replies | |
| 13/14 | restore-files: make pathspec mandatorybuiltin/ | +6 | 0 replies | |
| 14/14 | doc: promote "git switch-branch" and "git restore-files"Documentation/ Documentation/ Documentation/ +22 more | +104 | 0 replies |
Reviews trailers per patch
No Reviewed-by, Acked-by or Tested-by trailers for v3 yet.
Cover letter [PATCH/RFC v3 00/14] Introduce new commands switch-branch and restore-files
v3 sees switch-branch go back to switch-branch (in v2 it was checkout-branch). checkout-files is also renamed restore-files (v1 was restore-paths). Hopefully we won't see another rename.
I'll try to summarize the differences between the new commands and 'git checkout' down here, but you're welcome to just head to 07/14 and read the new man pages.
'git switch-branch'
- does not "do nothing", you have to either switch branch, create a new branch, or detach. "git switch-branch" with no arguments is rejected.
- implicit detaching is rejected. If you need to detach, you need to give --detach. Or stick to 'git checkout'.
- -b/-B is renamed to -c/-C with long option names
- of course does not accept pathspec
'git restore-files'
- takes a ref from --from argument, not as a free ref. As a result, '--' is no longer needed. All non-option arguments are pathspec
- pathspec is mandatory, you can't do "git restore-files" without any pathspec.
- I just remember -p which is allowed to take no pathspec :( I'll fix it later.
- Two more fancy features (the "git checkout --index" being the default mode and the backup log for accidental overwrites) are of course still missing. But they are coming.
I did not go replace "detached HEAD" with "unnamed branch" (or "no branch") everywhere because I think a unique term is still good to refer to this concept. Or maybe "no branch" is good enough. I dunno.
Nguyễn Thái Ngọc Duy (14):
git-checkout.txt: fix one syntax line git-checkout.txt: split detached head section out
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 into switch-branch and restore-files
switch-branch: better names for -b and -B
switch-branch: stop accepting pathspec
switch-branch: reject "do nothing" case
switch-branch: only allow explicit detached HEAD
restore-files: take tree-ish from --from option instead
restore-files: make pathspec mandatory
doc: promote "git switch-branch" and "git restore-files"
.gitignore | 2 + Documentation/config/advice.txt | 10 +- Documentation/config/checkout.txt | 5 +- Documentation/detach-head.txt | 132 +++++++++ Documentation/git-branch.txt | 8 +- Documentation/git-check-ref-format.txt | 2 +- Documentation/git-checkout.txt | 140 +-------- Documentation/git-format-patch.txt | 2 +- Documentation/git-merge-base.txt | 2 +- Documentation/git-rebase.txt | 2 +- Documentation/git-remote.txt | 2 +- Documentation/git-rerere.txt | 10 +- Documentation/git-reset.txt | 18 +- Documentation/git-restore-files.txt | 167 +++++++++++ Documentation/git-revert.txt | 2 +- Documentation/git-stash.txt | 6 +- Documentation/git-switch-branch.txt | 289 +++++++++++++++++++ Documentation/gitattributes.txt | 2 +- Documentation/gitcli.txt | 4 +- Documentation/gitcore-tutorial.txt | 18 +- Documentation/giteveryday.txt | 24 +- Documentation/githooks.txt | 5 +- Documentation/gittutorial-2.txt | 2 +- Documentation/gittutorial.txt | 4 +- Documentation/revisions.txt | 2 +- Documentation/user-manual.txt | 54 ++-- Makefile | 2 + advice.c | 11 +- builtin.h | 2 + builtin/checkout.c | 380 ++++++++++++++++++------- command-list.txt | 4 +- git.c | 2 + parse-options-cb.c | 16 ++ parse-options.h | 3 +- sha1-name.c | 2 +- wt-status.c | 2 +- 36 files changed, 1006 insertions(+), 332 deletions(-) create mode 100644 Documentation/detach-head.txt create mode 100644 Documentation/git-restore-files.txt create mode 100644 Documentation/git-switch-branch.txt
Signature · 1 line
2.20.0.rc1.380.g3eb999425c.dirty