git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Michel Lespinasse <walken@google.com>
To: Jeff King <peff@peff.net>
Cc: Junio C Hamano <gitster@pobox.com>,
	Tay Ray Chuan <rctay89@gmail.com>,
	Git Mailing List <git@vger.kernel.org>
Subject: Re: [PATCH 3/3] builtin/checkout: DWIM with -f -b
Date: Sun, 20 Jun 2010 21:09:35 -0700	[thread overview]
Message-ID: <AANLkTikvTtmz_uai5SNO0Co8PWLgK7rIdl7cCqHosViY@mail.gmail.com> (raw)
In-Reply-To: <AANLkTildfbJvt15cObc52LvOQRvasL4WYsJq3126bBGd@mail.gmail.com>

On Sun, Jun 20, 2010 at 7:58 PM, Michel Lespinasse <walken@google.com> wrote:
> On Sun, Jun 20, 2010 at 2:16 PM, Jeff King <peff@peff.net> wrote:
>> 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.

      reply	other threads:[~2010-06-21  4:11 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-06-20 16:33 [PATCH 0/3] DWIM with "git checkout -f -b" Tay Ray Chuan
2010-06-20 16:33 ` [PATCH 1/3] add tests for checkout -b Tay Ray Chuan
2010-06-20 16:33   ` [PATCH 2/3] t2018-checkout-branch.sh: show that checkout -f -b doesn't DWIM Tay Ray Chuan
2010-06-20 16:33     ` [PATCH 3/3] builtin/checkout: DWIM with -f -b Tay Ray Chuan
2010-06-20 19:12       ` Junio C Hamano
2010-06-20 20:11         ` Jeff King
2010-06-20 21:07           ` Clemens Buchacher
2010-06-20 21:10           ` Junio C Hamano
2010-06-20 21:16             ` Jeff King
2010-06-21  0:09               ` Junio C Hamano
2010-06-21  1:08                 ` Tay Ray Chuan
2010-06-21  5:15                   ` Junio C Hamano
2010-06-21 17:19                     ` [PATCH 0/3] teach git-checkout -B WAS " Tay Ray Chuan
2010-06-21 17:19                       ` [PATCH 1/3] add tests for checkout -b Tay Ray Chuan
2010-06-21 17:19                         ` [PATCH 2/3] builtin/checkout: change -b from an OPTION_STRING to a OPTION_SET_INT Tay Ray Chuan
2010-06-21 17:19                           ` [PATCH 3/3] builtin/checkout: learn -B Tay Ray Chuan
2010-06-23 18:36                             ` Junio C Hamano
2010-06-23 19:13                               ` Tay Ray Chuan
2010-06-21 23:04                           ` [PATCH 2/3] builtin/checkout: change -b from an OPTION_STRING to a OPTION_SET_INT Erick Mattos
2010-06-23 19:04                             ` Tay Ray Chuan
2010-06-23 21:37                               ` Erick Mattos
2010-06-21 17:24                       ` [PATCH 0/3] teach git-checkout -B WAS builtin/checkout: DWIM with -f -b Tay Ray Chuan
2010-06-21 21:30                         ` Erick Mattos
2010-06-23 19:28                       ` [PATCH v2 " Tay Ray Chuan
2010-06-23 19:28                         ` [PATCH v2 1/3] add tests for checkout -b Tay Ray Chuan
2010-06-23 19:28                           ` [PATCH v2 2/3] builtin/checkout: reword hint for -b Tay Ray Chuan
2010-06-23 19:29                             ` [PATCH v2 3/3] builtin/checkout: learn -B Tay Ray Chuan
2010-06-21  2:58               ` [PATCH 3/3] builtin/checkout: DWIM with -f -b Michel Lespinasse
2010-06-21  4:09                 ` Michel Lespinasse [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=AANLkTikvTtmz_uai5SNO0Co8PWLgK7rIdl7cCqHosViY@mail.gmail.com \
    --to=walken@google.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=peff@peff.net \
    --cc=rctay89@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).