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

From: Dave Cottlehuber <dch_at_skunkwerks.at>
Date: Sat, 03 Dec 2022 21:02:20 UTC
On Sat, 3 Dec 2022, at 18:15, Nuno Teixeira wrote:
> Really nice.
>
> I'm thinking on 3 trees for ports:
>
> - main (push)
> - 2022Qn (cherry-pick, push)
> - test (push to main when testing done)
>
> $ git clone https://git.freebsd.org/ports ports/main
> $ cd ports/main
> $ git worktree add ../2022Q4 -b 2022Q4 origin/2022Q4
> $ git worktree add ../test -b main origin/main
>
> My question is how do I push a commit from 'test' to 'main'?
>
> This sugestion is because I can have several ports in testing fase on 
> 'test' branch and choose a specific commit to push to 'main' (local 
> branch) and then do a final push.


this would be similar to my setup, too.

I have 3+ branches, as separate worktrees.

- main -> dch/main
- upstream -> freebsd-ports/main
- quarterly -> freebsd-ports/2022Q4 or whatever

my workflow is roughly as follows:

## do stuff, rebase it on upstream
$ cd /usr/ports (now in dch/main)
$ hack hack hack, git commit stuff on a pile of other crufty commits
$ git fetch upstream/main && git branch --force upstream upstream/main
$ git rebase --ignore-date --interactive upstream/main
$ run some poudrieres, mmmm so good

## pull these over to upstream and push
$ cd ~/ports/upstream
$ git cherry-pick main main~1 main~2
$ git push -u upstream HEAD:main

## woops we should MFH these to quarterly
$ cd ~/ports/quarterly
$ git fetch upstream 2022Q4 && git reset --hard upstream/2022Q4
$ git cherry-pick -x main main~1 main~2
$ git push -u quarterly HEAD:main

I think I got that more or less correct, it's a little confusing
where all the different mains point to initially.

Periodically, I need to adjust in .git/config where my "quarterly"
points to, then the git reset again just works.

A+
Dave