-
-
Couldn't load subscription status.
- Fork 657
Workflow with git worktree with a bare repo #1507
-
Hello everyone,
I am testing out a new workflow where I would use git worktrees instead of git stashes.
I am fairly new to git worktree so please bear with me if I miss out on something.
This is how I intend to organize new projects:
my-awesome-project/
├── .bare/
├── .git
├── bugfix/
├── feature-branch/
└── main/
my-awesome-project/ has three branches: bugfix, feature-branch, and main.
With this organization, .bare/ contains the bare repo (cloned from remote) and .git just points to .bare/.
Contents of .bare/ is essentially:
.bare
├── branches
├── config
├── description
├── HEAD
├── hooks
├── info
├── logs
├── objects
├── packed-refs
├── refs
└── worktrees
Contents of .git
gitdir: ./.bare
Now to my question:
Since the two branches are on different folders, GitUI throws me an error if I try to checkout to another branch
Screenshot from 2023年01月14日 20-09-59
Is there a way to configure GitUI or .gitconfig to work around this error?
Checking out to another branch is basically cd-ing to another folder but, if it's possible to not leave Neovim, that would be awesome.
If you have suggestions/ideas to improve this kind of workflow, I'm all ears :)
Note:
An nvim plugin exists for git worktree on bare repos: git-worktree.nvim
I tried it, but I wanted to use GitUI as much as possible.
Beta Was this translation helpful? Give feedback.