Re: git: "overlay" of own remote-branch on official freebsd-ports repo

From: Felix Palmen <felix_at_palmen-it.de>
Date: Tue, 12 Oct 2021 16:42:11 UTC
* Warner Losh <imp@bsdimp.com> [20211012 10:01]:
> tl;dr: branches are cheap and well supported in git. You just make a branch
> for your
> local changes, and update that however you see fit.
> 
> For ports I have like that, I've just created a branch in git. I rebase the
> branch forward
> each time I update.

+1, I do basically the same. I'd say having a local branch in your local
repo is one ot the killer features of git over svn.

I just do a few details slightly different, maybe it helps as one
possible example. I only fetch 'main' from the official repo and rebase
my 'local' branch onto that. During the rebase, it's easy to solve any
conflicts with changes in 'main'. You still keep a list of your local
commits, well organized.

I recently decided to also publish my local branch. So now I just have
two remotes on my local ports repo, the official FreeBSD repo and
another one on github, looking like this:

  # git remote -v
  origin  https://github.com/Zirias/zfbsd-ports.git (fetch)
  origin  https://github.com/Zirias/zfbsd-ports.git (push)
  upstream        https://git.freebsd.org/ports.git (fetch)
  upstream        https://git.freebsd.org/ports.git (push)

With that and remote branch tracking set up correctly, I just need these
commands (I have them in a script) to update from the official repo,
rebase and force push to my github repo:

  git checkout local
  git fetch upstream main:main && git rebase main
  git push -f --all

BTW, git leaves working copy changes alone if possible, so maybe it's
poudriere's way of using git that erases them – just use git directly
instead of poudriere. And then, I always hated having random local
changes not organized in any way, this quickly grows into a maintenance
nightmare, so I'm very thankful I can now easily use git branches
instead.

-- 
 Dipl.-Inform. Felix Palmen  <felix@palmen-it.de>   ,.//..........
 {web}  http://palmen-it.de  {jabber} [see email]   ,//palmen-it.de
 {pgp public key}     http://palmen-it.de/pub.txt   //   """""""""""
 {pgp fingerprint} A891 3D55 5F2E 3A74 3965 B997 3EF2 8B0A BC02 DA2A