Re: [PATCH v4 00/26] Add new command 'switch'
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Mar 18, 2019, 04:54 UTC
- Message-ID
- <xmqq4l806avp.fsf@gitster-ct.c.googlers.com>
- In-Reply-To
- <CACsJy8BevFGXt-RL_1G263ntXYee69N055TY8_GQL1unvJNPnw@mail.gmail.com>
Duy Nguyen <pclouds@gmail.com> writes:
Show 5 quoted lines
> I did forget one thing: > > - 'git switch' refuses to switch in the middle of > rebase/bisect/cherry-pick/... session. Add --ignore-in-progress to > override this
I think that is a sensible thing to do. Once I did not realize that a "checkout" from a failed cherry-pick with the state files left in the .git/ directory took me to a strange state, causing some later operation to act on these state files as if a cherry-pick were in progress (and somehow the shell prompt support did not report it, perhaps because the copy I use was out of sync with the binary).
Making sure that during a stateful operation the working tree won't get switched to a different branch is probably a good idea.
I often find "git reset --hard <some other starting point>" after a failed "git checkout -b new <starting point> && git am -s3c", so I'd be opposed to a change to refuse a "reset --hard" during the middle of such a stateful operation, but I do not think of a reason why I would want to "switch" in the middle.
> Now that I mention this, --ignore-in-progress should probably be part > of --force too. Hmm...
Probably. You may want to decline other parts of what --force allows but when you say --force, --ignore-in-progress should be implied.