Thread (50 messages) 50 messages, 15 authors, 2021-11-30

Re: changing the experimental 'git switch' (was: [Summit topic] Improving Git UX)

flat view

From: martin <hidden>
Date: 2021-10-23 08:08:24

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?
quoted
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.
quoted
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?

Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help