Skip to content

Commit 99a26bb

Browse files
committed
fix: setting upstream after creating worktree from origin branch
## what - setting upstream after creating worktree from origin branch ## how - find and replace `origin/` to `` using the `branch` variable ## why - when creating worktree from origin branch (ex `origin/branch-1`), it would add the upstream as `origin/origin/branch-1` - this will fix the duplicate origin issue ## where - ./lua/git-worktree/init.lua ## usage
1 parent 2517409 commit 99a26bb

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

lua/git-worktree/init.lua

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -316,6 +316,7 @@ local function create_worktree(path, branch, upstream, found_branch)
316316
end
317317
})
318318

319+
branch = branch:gsub("origin/", "")
319320
local set_branch_cmd = 'git'
320321
local set_branch_args= {'branch', string.format('--set-upstream-to=%s/%s', upstream, branch)}
321322
local set_branch = Job:new({

0 commit comments

Comments
 (0)