From f61a245e268c713e7399f8b04062340631f2d4d6 Mon Sep 17 00:00:00 2001 From: Anton Rogov Date: Wed, 21 May 2025 22:49:00 +0300 Subject: [PATCH] upstream push to a branch with a different name --- lua/neogit/popups/push/actions.lua | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/lua/neogit/popups/push/actions.lua b/lua/neogit/popups/push/actions.lua index 4af6216e0..05817efff 100644 --- a/lua/neogit/popups/push/actions.lua +++ b/lua/neogit/popups/push/actions.lua @@ -31,6 +31,10 @@ local function push_to(args, remote, branch, opts) logger.debug("Pushing to " .. name) notification.info("Pushing to " .. name) + local current_branch = git.branch.current() + if branch and current_branch ~= branch then + branch = current_branch .. ":" .. branch + end local res = git.push.push_interactive(remote, branch, args) -- Inform the user about missing permissions @@ -83,9 +87,12 @@ function M.to_upstream(popup) remote, branch = git.branch.parse_remote_branch(upstream) else set_upstream = true - branch = git.branch.current() - remote = git.branch.upstream_remote() - or FuzzyFinderBuffer.new(git.remote.list()):open_async { prompt_prefix = "remote" } + local target = FuzzyFinderBuffer.new(git.refs.list_remote_branches()):open_async { + prompt_prefix = "push", + } + if target then + remote, branch = git.branch.parse_remote_branch(target) + end end if remote then