Open calebdw opened 3 months ago
you pass in a relative path in the worktree create function. So you should be able to create a worktree with '../
I like this feature but there are so many ways people use git and worktrees that I am trying to keep the API simple and let the user interact with the plugin based on their git workflow
I do need to keep improving the documentation to showcase use cases or maybe have a wiki with common ones.
Sounds good, after some more experience, I realized there was no need for the .bare/
dir and .git
file pointing to .bare/
---you can just rename .bare
to .git
and everything still works! The repo is a bare repo and the git files aren't littering the root directory, I think this would at least be a good usecase to support?
~/sources/neovim/git-worktree.nvim$ ls
.git/
main/
# ... other worktrees
you pass in a relative path in the worktree create function. So you should be able to create a worktree with '../' when you make it. the worktree create function creates the folder from the gitdir which in your case is the bare repo.
I have a similar setup, that is, a repo cloned bare, but when I pass ../
, nothing happens, but passing the absolute path indeed triggers the creation of the worktree. Could it be the case that the resolution of relative paths does not accept paths outside the current working directory?
Being able to pass ../
would completely solve the issue for my case at least
Apologies, I did more testing: it seems that when passing ../
because this check gets triggered:
https://github.com/polarmutex/git-worktree.nvim/blob/500629d0ad916ec362f53ecf21f84f3ba445f73e/lua/git-worktree/worktree.lua#L94-L98
Hello!
I just switched over to using bare repos with git worktrees and I think it's awesome!
I was reading a lot of articles, and I found that it's popular to place all the git related stuff into a
.bare
folder to make a really clean looking directory structure---all the worktrees are front and center without a bunch of noise:where the
.git
folder just contains:However, when I create worktrees with this plugin it places the new worktree into the
.bare
dir instead of with the rest of the worktrees up a level from.bare
. It would be awesome if this plugin could detect the existence of the.bare
dir and move the new worktree up a level!Just for grins, here is a script I found online and adapted to easily clone repos that follow this bare/worktree setup.
`git-clone-bare-for-worktrees`
```bash #!/usr/bin/env bash set -e usage() { echo "Usage: $0 [--upstream=Thanks!