3 ms·
this is what I do as well but my structure is `~/git/<project>/<worktree>` for the worktrees and a bare git repo is stored in `~/git/<project>/.git`. The workf
by CuriousCosmic 3y ago
this is what I do as well but my structure is `~/git/<project>/<worktree>` for the worktrees and a bare git repo is stored in `~/git/<project>/.git`.
The workflow I do is
1. git clone https://path.to/repo.git https://path.to/repo.git
2. mv repo/.git repo.git && rm -rf ./repo && mkdir repo && mv repo.git repo/.git && cd repo
3. git config --bool core.bare true
Now you can just create worktrees in the root of the git repo.
This has the advantage that the `~/git/<project>` directory is still understood as root of the git repo and the worktrees are never checked out inside the working tree directory.
- vaibhavsagar 3y agoWhy not `git clone --bare`?
- v7engine 3y agoI've tried this and it seems to be working fine. git clone --bare https://path.to/repo.git https://path.to/repo.git mv repo.git .git now we can create worktrees in the same folder.
- CuriousCosmic 3y agofwiw you can actually one line that > git clone --bare https://path.to/repo.git https://path.to/repo.git .git
- CuriousCosmic 3y agoYou can bare clone and it works fine. This is in part just habit from converting existing repos into bare + worktree repos.