git-worktree.nvim icon indicating copy to clipboard operation
git-worktree.nvim copied to clipboard

Git Work trees Auto Merging master / Not setting branches correctly

Open nick22985 opened this issue 1 year ago • 0 comments

I am trying to use git-worktree.nvim (or worktrees in general neither ways work)

  1. git clone --bare [email protected]:/ ./
  2. git worktree add ./path/ (or do it in the git worktree nvim menu)
  3. cd path
  4. git reset --soft HEAD~1 (to mimic a state that needs pulling)
  5. git pull (this pulls down the master branch and merges it with current branch

I have tried setting git config remote.origin.fetch "+refs/heads/*:refs/remotes/origin/*" which fixes the issue of pulling

However this causing all the branches to now have origin/ in them. Now trying to use git worktrees nvim to download a new worktree. Causes them to download origin/ if no path is specified. If I specify a path it will create it but the branch is not linked it says to do this in the git help message when pulling

git pull
There is no tracking information for the current branch.
Please specify which branch you want to merge with.
See git-pull(1) for details.

    git pull <remote> <branch>

If you wish to set tracking information for this branch you can do so with:

    git branch --set-upstream-to=origin/<branch> origin/<branch>

doing what the command says here git branch --set-upstream-to=origin/<branch> origin/<branch> leads me to another error

git branch --set-upstream-to=origin/<branch> origin/<branch>
warning: refname 'origin/<branch>' is ambiguous.
fatal: ambiguous object name: 'origin/<branch>'

Does anyone know what is going on here or how to properly use work trees in a bare repo and have all the branches able to be pulled / updated / downloaded correctly?

nick22985 avatar Jan 22 '24 10:01 nick22985