Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Workflow with git worktree with a bare repo #1507

jfvillablanca started this conversation in General
Discussion options

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.

You must be logged in to vote

Replies: 0 comments

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
1 participant

AltStyle によって変換されたページ (->オリジナル) /