Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 10 additions & 3 deletions lua/neogit/popups/push/actions.lua
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,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
Expand Down Expand Up @@ -88,9 +92,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
Expand Down