Re: Fwd: Right way to make a store local changes to repos

From: Marc Branchaud <marcnarc_at_gmail.com>
Date: Thu, 19 Oct 2023 22:37:52 UTC
On 2023-10-18 11:08, Anton Saietskii wrote:
> Hi folks,
> 
> Here's what I'm doing:
> * "git clone .../ports.git"
> * since there are some patches which will never hit main tree (like
> ccache support in bsd.gecko.mk), "git checkout -b local"
> * "git pull -r" when I'm on local, hacking, commits, pull again, ...
> * if I need to make some patch and send it -- I do "git checkout -b
> <feature>" from local and "diff"/"format-patch local" when ready, then
> "git checkout local" back
> 
> To summarize:
> origin/main -> main
> local == I pull here, store local patches here

So you are not keeping your local "main" branch up to date.  That's 
perfectly reasonable.

> feature-X == creating from local, I do patches which I send back here
> 
> But sometimes, though not very often, I need to create a patch from a
> clean tree (or switch to it for another reason), and here comes the
> issue: "local" is up to date with "origin/main", but "main" is not.
> Let's say it's 1000 commits behind (with only ~5 local ones), and
> those commits changed 4000 files, so when I do "git checkout main" --

Don't checkout "main", since it's so out of date.

Instead, create and checkout a new branch for your "clean" patch, based 
on "origin/main" (which is kept up to date by your pulls):

	git checkout -b my-clean-patch-branch origin/main

		M.