Skip to content

Commit 42890ea

Browse files
antonrogovCKolkey
authored andcommitted
upstream push to a branch with a different name
1 parent 49d0527 commit 42890ea

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

lua/neogit/popups/push/actions.lua

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,10 @@ local function push_to(args, remote, branch, opts)
3636
logger.debug("Pushing to " .. name)
3737
notification.info("Pushing to " .. name)
3838

39+
local current_branch = git.branch.current()
40+
if branch and current_branch ~= branch then
41+
branch = current_branch .. ":" .. branch
42+
end
3943
local res = git.push.push_interactive(remote, branch, args)
4044

4145
-- Inform the user about missing permissions
@@ -88,9 +92,12 @@ function M.to_upstream(popup)
8892
remote, branch = git.branch.parse_remote_branch(upstream)
8993
else
9094
set_upstream = true
91-
branch = git.branch.current()
92-
remote = git.branch.upstream_remote()
93-
or FuzzyFinderBuffer.new(git.remote.list()):open_async { prompt_prefix = "remote" }
95+
local target = FuzzyFinderBuffer.new(git.refs.list_remote_branches()):open_async {
96+
prompt_prefix = "push",
97+
}
98+
if target then
99+
remote, branch = git.branch.parse_remote_branch(target)
100+
end
94101
end
95102

96103
if remote then

0 commit comments

Comments
 (0)