Closed socketbox closed 1 month ago
I would be interested in this too, and might look into this. @jesseduffield would this be good as a first issue?
I suspect the fix is as simple as this:
diff --git a/pkg/commands/git_commands/sync.go b/pkg/commands/git_commands/sync.go
index 4ab1f336b..d6842e655 100644
--- a/pkg/commands/git_commands/sync.go
+++ b/pkg/commands/git_commands/sync.go
@@ -33,7 +33,7 @@ func (self *SyncCommands) PushCmdObj(task gocui.Task, opts PushOpts) (oscommands
ArgIf(opts.Force, "--force-with-lease").
ArgIf(opts.SetUpstream, "--set-upstream").
ArgIf(opts.UpstreamRemote != "", opts.UpstreamRemote).
- ArgIf(opts.UpstreamBranch != "", opts.UpstreamBranch).
+ ArgIf(opts.UpstreamBranch != "", "HEAD:"+opts.UpstreamBranch).
ToArgv()
cmdObj := self.cmd.New(cmdArgs).PromptOnCredentialRequest(task)
Good first issue? Probably, all that's missing is adapting the failing unit tests.
There might be a few other problems related to branches whose upstream branch doesn't have the same name; for example, hitting d
and choosing to delete the upstream branch doesn't work for these, as it's trying to delete an upstream branch with the same name. Another one is that pushing to such a branch fails with an error if git's push.default
is set to "simple". But these could be solved independently.
Perfect! I'm very new to Go so will be happy to do this.
Fixed by #3630.
Is your feature request related to a problem? Please describe. Let's say that I've created a local branch and committed to it. When I go to push to the remote for the first time, I have a change of mind and want to give the remote branch (perhaps the work has changed in scope) a different name.
When I do that now, I receive the following error:
Describe the solution you'd like I'd like to be presented with the option of creating the remote branch with the desired name.
Describe alternatives you've considered
git
)Additional context![image](https://github.com/jesseduffield/lazygit/assets/1593835/c1e6cce1-e3b6-4e8b-9329-173f67cec93c)