Date: Fri, 11 Dec 2020 11:13:20 -0700 From: Warner Losh <imp@bsdimp.com> To: Marc Branchaud <marcnarc@gmail.com> Cc: Konstantin Belousov <kostikbel@gmail.com>, git@freebsd.org Subject: Re: svnadmin equivalent? Message-ID: <CANCZdfqsZETvn%2BiuTi%2Bam%2Ba44J02BR1jafYZgkA8B4Nf7z5pGQ@mail.gmail.com> In-Reply-To: <CANCZdfrVku02pOZTHVZnoAurhp59O4L7JWTjzPWg33DfUHekJQ@mail.gmail.com> References: <20201210223443.GA64504@freefall.freebsd.org> <CAKBkRUwjJF9nY=JyNkZgGq67QBKhmVhu61YU_Gt_nz3uhvYf%2Bw@mail.gmail.com> <X9LuAwJlrnR2mzRS@kib.kiev.ua> <CAKBkRUziop1eipR3MA5GyzNaTF1Yn=r3Bh77jRB_VxgmUqppmQ@mail.gmail.com> <X9L29kI8IEY%2BlHrh@kib.kiev.ua> <CANCZdfojavQj3oJXUdW5rb%2B6nL=jSMvC=-3KUMJDc1yYXSEtkg@mail.gmail.com> <8e48e2ea-59d8-d2fd-4e25-e12088ff3a36@gmail.com> <CANCZdfrVku02pOZTHVZnoAurhp59O4L7JWTjzPWg33DfUHekJQ@mail.gmail.com>
next in thread | previous in thread | raw e-mail | index | archive | help
Hi Marc Thanks for the detailed explanation. I've updated https://github.com/bsdimp/freebsd-git-docs/blob/main/faq.md to include details discussed here. Please let me know if I've missed anything, or if I've botched something. BTW, I wasn't sure why you needed to reset the default first. Most people will have that or just that an the notes. There's no reason you can't add this too that I can see, but maybe I'm overlooking something. Warner On Fri, Dec 11, 2020 at 9:32 AM Warner Losh <imp@bsdimp.com> wrote: > > > On Fri, Dec 11, 2020 at 8:49 AM Marc Branchaud <marcnarc@gmail.com> wrote: > >> On 2020-12-10 11:37 p.m., Warner Losh wrote: >> > On Thu, Dec 10, 2020, 9:35 PM Konstantin Belousov <kostikbel@gmail.com> >> > wrote: >> >> >> >> Can we have it scripted, per repo, and scripts available somewhere ? >> >> It is convoluted list of per-repo branches. I want a simple means to >> >> run something and get the guaranteed clone of all material from the >> repo. >> >> >> > >> > git clone --mirror >> >> "git clone --mirror" fetches everything, but it has two potentially >> confusing side-effects: >> >> * Mirroring creates a "bare" local repository without any checked-out >> files (all you get are the contents of the remote's .git/ directory). >> This doesn't mean it's unusable, just that it's not *directly* usable >> (for example, see Mathieu's suggestion about "git worktree add"). >> >> * More subtly, mirroring also removes the distinction between your local >> branches and the remote repo's branches. So you don't end up with any >> "origin/XXXX" branches. This can be very confusing when you've made >> commits to your local "main" branch that get clobbered by your next fetch. >> >> Here's how to get absolutely everything in your regular-clone'd repo >> while preserving the "origin/" namespace for the official repo's branches: >> >> # First reset the config to the default that a non-mirror clone creates: >> git config --replace-all remote.origin.fetch >> '+refs/heads/*:refs/remotes/origin/*' >> (WARNING: If you've configured other remote.origin.fetch specs, like to >> retrieve the "notes" namespace, this command will remove those and >> you'll have to re-configure them.) >> >> # Then configure fetch to also get all the other stuff: >> git config --add remote.origin.fetch '+refs/*:refs/origin/*' >> >> The default setting is important to make commands that interpret branch >> names work properly with remote ("origin/<branchname>") branches, >> because they look for remote branch names under the refs/remotes/ >> namespace. >> >> The second setting puts *every* reference in the remote repo into your >> repo's "refs/origin/" namespace. Since nothing in git uses the >> "refs/origin/" namespace we're free to do whatever we want with it >> without breaking anything. The slight inconvenience is that to access a >> non-branch, non-tag symbol we have to prefix it with "refs/origin/" (not >> just "origin/"): >> git show refs/origin/internal/admin:mentors >> git log refs/origin/vendor/zlib/1.2.10 >> git checkout -b my-arm64-hacks refs/origin/projects/arm64 >> > > That;s good advice. I'll add this to my FAQ. > > It is a bit like checking out from http://svn.freebsd.org/base, though, > which gets a lot of chaff... > > Warner >
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CANCZdfqsZETvn%2BiuTi%2Bam%2Ba44J02BR1jafYZgkA8B4Nf7z5pGQ>