Skip to content

DWIM with "git checkout -f -b"

Tay Ray Chuan git 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest3 patches 15 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/3add tests for checkout -bt/t2018-checkout-branch.sh+66 -00 replies
1/3add tests for checkout -bt/t2018-checkout-branch.sh+121 -00 replies
2/3t2018-checkout-branch.sh: show that checkout -f -b doesn't DWIMt/t2018-checkout-branch.sh+20 -00 replies
2/3builtin/checkout: change -b from an OPTION_STRING to a OPTION_SET_INTbuiltin/checkout.c+26 -153 replies
3/3builtin/checkout: DWIM with -f -bDocumentation/git-checkout.txt builtin/checkout.c t/t2018-checkout-branch.sh+8 -517 replies
3/3builtin/checkout: learn -BDocumentation/git-checkout.txt builtin/checkout.c t/t2018-checkout-branch.sh+63 -42 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCH 0/3] DWIM with "git checkout -f -b"

Right now, the -f/--force in git-checkout doesn't carry over to -b operations - ie. you can't do git checkout -b branch on an existing branch. This patch series changes this, so that one can do

git checkout -f -b branch ref

which is equivalent to

git branch -f branch ref && git checkout branch

Contents:
[PATCH 1/3] add tests for checkout -b
[PATCH 2/3] t2018-checkout-branch.sh: show that checkout -f -b doesn't DWIM [PATCH 3/3] builtin/checkout: DWIM with -f -b

 Documentation/git-checkout.txt |    3 +
 builtin/checkout.c             |    4 +-
 t/t2018-checkout-branch.sh     |   86 ++++++++++++++++++++++++++++++++++++++++
 3 files changed, 91 insertions(+), 2 deletions(-)
 create mode 100755 t/t2018-checkout-branch.sh