Thread (4 messages) flat view 4 messages, 3 authors, 2016-06-15

Re: [PATCH 3/3] builtin/checkout: DWIM with -f -b

From: Michel Lespinasse <hidden>
Date: 2016-06-15 22:48:59

On Sun, Jun 20, 2010 at 7:58 PM, Michel Lespinasse [off-list ref] wrote:
On Sun, Jun 20, 2010 at 2:16 PM, Jeff King [off-list ref] wrote:
quoted
I'm certainly sympathetic, but as I understand it, with this new patch
you are doing the equivalent of:

 git branch -f jch master
 git checkout -f jch

which is different than what you wrote above.  For your workflow, I
doubt it matters, but it is potentially destructive.
I am frequently trying to do this as well, so I would love the
checkout -f -b option.

However, I think that the desired behavior for checkout -f -b is that
it should be equivalent to:
git branch -f jch master
git checkout jch   (without the -f here)
Rhaaa, that actually wouldn't work as the git checkout command would
fail if there are changes in the index & working tree. What I want
here is actually for git checkout -f -b jch to be equivalent to:

git branch -D jch  (ignore error if jch branch does not exist)
git checkout -b jch
rationale: git checkout -b normally preserves the index & the working
tree; adding the -f flag to a command that would otherwise succeed
should not change its behavior.
At least the rationale still holds :)

-- 
Michel "Walken" Lespinasse
A program is never fully debugged until the last user dies.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help