-
-
Notifications
You must be signed in to change notification settings - Fork 128
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: dont set origin prefix 2 times #104
base: master
Are you sure you want to change the base?
fix: dont set origin prefix 2 times #104
Conversation
Thank you @zkygr, I created a zsh function to do this for now. Hopefully these fix PRs get merged one day so I don't need the function anymore. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see it only fixes git worktree add command, but still problem is with setting corectly upstream. I've got following command from step 5 in creation of worktree:
5/8: git branch --set-upstream-to=origin/origin/XXXX
@pjedynak you can string replace git-worktree.nvim/lua/git-worktree/init.lua Lines 319 to 328 in c8ff32c
add the code right before Line 319 branch = branch:gsub("origin/", "") it'd look like this branch = branch:gsub("origin/", "")
local set_branch_cmd = 'git'
local set_branch_args= {'branch', string.format('--set-upstream-to=%s/%s', upstream, branch)}
local set_branch = Job:new({
command = set_branch_cmd,
args = set_branch_args,
cwd = worktree_path,
on_start = function()
status:next_status(set_branch_cmd .. " " .. table.concat(set_branch_args, " "))
end
})
PS: I don't know how to suggest a change outside of file changed area |
## what - apply PR ThePrimeagen#104 ## how ## why - main repo owner hasn't applied PR - fixes issue when creating worktree from a origin branch ## where - ./lua/git-worktree/init.lua ## usage
Hello!
When creating a new worktree from a remote ref the
origin/
prefix is added 2 times to the tracking branch.git worktree
can handle the case that one tracking branch exists when a new worktree should be created.The PR fixes the Issue #77
Links: