Re: changing the experimental 'git switch' (was: [Summit topic] Improving Git UX)
- From
- martin <test2@mfriebe.de>
- Date
- Oct 22, 2021, 15:30 UTC
- Message-ID
- <dc5dcc43-34d0-f4a8-93fa-6875c98e74a5@mfriebe.de>
- In-Reply-To
- <211022.86v91pjfn7.gmgdl@evledraar.gmail.com>
On 22/10/2021 16:24, Ævar Arnfjörð Bjarmason wrote:
> FWIW one reason this would be needed is that "switch" intentionally did > not take "git switch unknown-name" to create "unknown-name", but maybe > we could relax that if we just e.g. printed out a notice saying a new > branch is created (which we probably do already...).
I think the "required flag for create" is a good idea and should be kept. (My 2 cents)
having the "new name" identified, also helps the user to get the order of the arguments right. Take git rebase <upstream> <branch> Why is the target listed before the source? But whichever way round, it is hard to remember. If rebase would only take one <upstream>, and the optional <branch> would be a "--from", wouldn't that be easier?
Show 5 quoted lines
>> If 2 letters could be used, then -c could be given twice for "create copy" >> -c => create >> -c -c => create copy >> -cc => create copy > Hrm, that's interesting. But probably better to have a long-option.
Well, both: Long and short. But long is --copy or --create-copy. The issue is finding a short option. -cc imho is still short.
Show 7 quoted lines
>> But in "git switch" a new commit for the top is given. So that differs. >> Maybe someone can educate me ? > Maybe I'm being dense, but I'm not really seeing how a: > > git switch [some create option] <new> <old> > > Would have caveats that we don't have already with:
I only tried to illuminate my question with some made-up examples (the examples were not meant to be a solution).
What exactly does copy/move do? Am I missing any point? - They create a new branch (when using switch this branch will also be reset to a given commit) - They copy the reflog - "move" deletes the old branch (or can be seen as rename)
Anything else?