Date: Wed, 28 Apr 2021 13:16:29 +0100 From: Steve O'Hara-Smith <steve@sohara.org> To: Andrea Venturoli <ml@netfence.it> Cc: freebsd-questions@freebsd.org Subject: Re: Maintaining my own branch with git Message-ID: <20210428131629.b644748817de331dbe2edef6@sohara.org> In-Reply-To: <d09f4bef-cbf2-3381-b120-ee62f0fb8b53@netfence.it> References: <d09f4bef-cbf2-3381-b120-ee62f0fb8b53@netfence.it>
next in thread | previous in thread | raw e-mail | index | archive | help
On Wed, 28 Apr 2021 13:49:23 +0200 Andrea Venturoli <ml@netfence.it> wrote: > Hello. > > I know tons of messages have been written on the subject: I read them > all, along with the Git Primer docs, but somehow I think I'm not doing > it right and I cannot understand what I'm doing wrong. > > I need to have some patches applied to both src and ports and distribute > them to several machines. > So I have my own git server and I want to keep my own FreeBSD branches. > > I cloned FreeBSD's git repository and pushed into my server; then I > created my own branches. OK let's stop there. I would not do that. I would do this: 1: Clone the FreeBSD repository into my work area 2: Create my branch(es) off freebsd/main like this: git checkout main git checkout -b myworkingbranch 3: Apply my patches in myworkingbranch and commit them to that branch NB: git commit --amend and git rebase -i are your dear friends for keeping a clean history in your branch. 4: Push myworkingbranch to your server whenever you're done with a commit Don't push the freebsd branches ever 5: Update main with git pull (while freebsd/main is checked out) NB: This will *always* be fast forward since you *never* commit to it 6: Update myworkingbranch with: git rebase main NB: This will stash your changes, bring in the updates and then reapply your changes, requiring you to sort out any conflicts that come up. 7: After this rebase you will need to force push myworkingbranch to your server Branches in git are cheap, easy and throwaway things make branches at the drop of a hat to keep separate threads of work separate, make integration branches to merge them into and test branches to load with throwaway debug and never think twice about doing it. -- Steve O'Hara-Smith <steve@sohara.org>
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20210428131629.b644748817de331dbe2edef6>