Re: git-switch(1) then git-pull(1)

From: Xin Li <delphij_at_delphij.net>
Date: Sat, 03 Dec 2022 08:48:52 UTC
On 2022-12-02 4:08 AM, Nuno Teixeira wrote:
> Not sure if I understand but I use `git switch` on ports tree to switch 
> from 'main' to 'quarterly' to avoid having 2 trees.

Somewhat unrelated to the original topic, but why would one want to 
avoid having two trees?  Personally I would use a worktree for this 
purpose, like:

$ git clone https://git.freebsd.org/ports ports/main
$ cd ports/main
$ git worktree add ../2022Q4 -b 2022Q4 origin/2022Q4

Then both trees would share the same set of git objects; after use the 
worktree can be deleted with:

$ git worktree remove 2022Q4

This is a lot easier than switching between branches, especially when 
the two branches diverged a lot (like src/).

Cheers,