Re: PATCH: improve git switch documentation

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 10/07/2021 12:24, Sergey Organov wrote:
Martin <git@xxxxxxxxxx> writes:
Actually, "new" or "create" would make sense in "git branch". But in
git switch, they actually raise the question "create what?" / "new
what?".

I believe that's because "git switch" tries to do too much. "git switch"
should rather switch between existing branches, and do nothing else. As
I said once in this discussion already: trouble writing good
documentation is often indication of some flaws in the design.

Creating (a branch) is fundamentally different operation than switching
to (a branch), and that's why the former doesn't fit into "git switch".


Right, yes. But creating a branch is often followed by switching to it.

So this is A shortcuts, that I actually think to be fine.
It does add value, as it does speed up a common operation.

Of course you could have
   git create-switch
or
   git branch-switch

I am not sure, that is really an improvement.



There is even discussion to add "-c" for "copy branch + switch" to git switch. Which I have no personal objection. Only find it regrettable that it means an incompatible change to -c. (Never mind that git switch is still "experimental". It has been so for a long time, for many people out there long enough to forget the "experimental")

And there is even discussion to add "-m" move/rename, to git switch.
Only that for the latter, most people would not even perceive a rename as doing a switch/checkout (technically the branchname in HEAD is updated, I guess).
So technically
   git branch -m newname
should change the branchname, but NOT update HEAD (detach)?
(Not sure what it does / not tested)
If git branch actually updates HEAD in that case, then "git switch -m" would be an identical copy, adding no value, therefore not required.



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux