Can it work with file://?
Yes: $ git init foo Initialized empty Git repository in .../foo/.git/ $ git clone "file://$PWD/foo" bar Cloning into 'bar'... But it's redundant: $ git clone bar baz Cloning into 'baz'... If you example .git/config in either clone, you'll see that remote.origin.url is the absolute path of the source repo. Note that you can share objects across clones on the same machine in various ways. See "--local", "--shared", and…
Local Git remotes
81–85 of 85 posts
Re: Local Git remotes
#82you can also setup a local remote which hardlinks the index so it doesn't occupy more space. Why? Idk. You don't want to share stash, rerere-cache, branches whatever. Also handy if you're running an agent in a container on the local fs. Set up a local clone, contain the agent to that repo folder and have it hack away on that. Later, you step out of the container and do the syncing. You can't use worktrees in this sit…
At that point you might as well use a worktree[1]. [1]: https://git-scm.com/docs/git-worktree
Re: Local Git remotes
#83You can also have multiple independent git repos that don't duplicate the full object store, via git clone --reference. It's less relevant in the container era, but otherwise it can save a lot of time and disk space when cloning repos repeatedly
Interesting; how's it compare to work trees?
Clones only share the immutable object store
For most practical uses of same repo checking out different branches locally, worktrees are better.
The nice thing about clones is that you can have a backup clone, a wip clone, a review clone where you don't clutter the amount of local branch refs
Re: Local Git remotes
#84Earlier quoted context omitted.
Interesting; how's it compare to work trees?
Worktrees effectively share the entire state of the repo. Only limitation is that a branch can only be checked out in one repo at a time. Clones only share the immutable object store For most practical uses of same repo checking out different branches locally, worktrees are better. The nice thing about clones is that you can have a backup clone, a wip clone, a review clone where you don't clutter the amount of local…