git-link
git-link copied to clipboard
not working for files in an auxiliary worktree (using git-worktree)
Given a git repository contained in the folder foo, if (from this folder) the command git worktree add ../foo-worktree-otherbranch otherbranch is executed, a worktree will be created for the otherbranch branch in the folder ../foo-worktree-otherbranch (relative to the foo folder).
When editing a file within the foo-worktree-otherbranch folder, and attempting to use git-link, the error Remote 'origin' not found occurs. Instead, git-link should be able to correctly identify the remote and branch. In the particular case this was tested under, the foo repository didn't even have an origin remote (but did have other remotes).
Instead, git-link should be able to correctly identify the remote and branch.
How to do that?
In the particular case this was tested under, the foo repository didn't even have an origin remote (but did have other remotes).
If git-link-default-remote nor git-link.remote are set, some place in the code will default to origin.
Closing . If the above git-link* options do not work for you feel free to reopen.
Ok thanks for the information - I believe that the problem has something to do with git-link not being able to determine what the upstream repository and tracked branch is in the case when a "git-worktree" branch is being used. If I have more time to investigate, and find out anything more specific, I'll reopen.
FWIW, I routinely use git-link with worktrees. It reliably finds the branch I am on. Since my remote is called origin, I would not have observed any issue determining the remote.