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

From: Warner Losh <>
Date: Sat, 03 Dec 2022 16:16:30 UTC
On Sat, Dec 3, 2022 at 8:59 AM Nuno Teixeira <> wrote:

> Hello,
> $ git clone ports/main
>> $ cd ports/main
>> $ git worktree add ../2022Q4 -b 2022Q4 origin/2022Q4
> So we will have ports/{main,2022Q4} and cd to main or 2022Q4 according if
> commit is to main or quarterly?
> I will try this soon because swithing from branches is not the best way
> (but I used it for about 1 year without problems).

I do this for my src commits. I have 3 trees: 'head', 'stable-13' and
'stable-12'. I have a lot of branches off of head
for work in progress that I switch between all the time to refine, finish
and land them. For especially large projects
I'll have a separate work tree, but usually the changes are small enough
that this works fine. I have a script that
rebases everything once and a while to keep my branches in sync. For
stable-12 I have a stable/12 branch locally
that mirrors upstream. I also have a stable/mfc12 branche that I
'insta-MFC' changes that I commit to head that need
time to cook before being pushed. I do this so I don't lose things. I then
rebase the stable/mfc12 onto stable/12 and push
when the time comes (doing the rebase dance as needed).