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

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

 



On 22/10/2021 16:04, martin wrote:
Unless there is more, than the copying of the reflog, wouldn't it be better to add an option "--copy-reflog"

Ok, I found the answer (actually 2 / see other mail)
The |-c| and |-C| options have the exact same semantics as |-m| and |-M|, except instead of the branch being renamed, it will be copied to a new name, along with its config and reflog.
As for the "config" being part depends on which part of the man-page one reads.

But, anyway on the topic of "git switch"

Copying a branch (and maybe moving too) could be seen as an extension to creating a new one. After all, after the copy operation there is a newly created branch. Only it has some more data with it.

So one could do
git switch  --settings-from <branch-with-reflog-and-conf> --create <new-branch>   <commit>
git switch  -s <branch-with-reflog-and-conf>   -c <new-branch>   <commit>

"settings-from" is just an example, there may be better names for it. Ideally not starting with a "c".

And using a name different from "copy" may be more accurate, because unless it is created on the same one <commit> to which the <branch-with-reflog-and-conf> points, then its at best partially copied.

On top of that options could be brought in, to copy only reflog or only config.

Using the above with an --force-create / -C would make it a "move branch".
In this case there could be a shortcut, if <branch-with-reflog-and-conf> and (the old) <new-branch>  are the same.





[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