Allow pushing with only remote, no branch name
Is your feature request related to a problem? Please describe.
I often set up my git repos with an origin remote and an additional fork remote.
Then, when I want to make a PR, I can fork off a new branch, commit, then run git push fork.
Git will then automatically push my current branch.
In lazygit (0.42.0), bringing up the push panel and deleting the branch name will come up with the error: Invalid upstream. Must be in the format '<remote> <branchname>'
Describe the solution you'd like Update the matching conditions for a valid push target
Under which name does git push fork push the branch?
E.g. if you are on a branch performance_fix and do git push fork?
It will push to whatever the upstream is set to for the current branch. You can check it with git branch -vv: SO link
I can't figure out why, I think this got set for me automatically the last couple times I used it while working.
It will push to whatever the upstream is set to for the current branch. You can check it with git branch -vv: SO link
That's probably dictated by your global gitconfig.
And you want to push it under the same name, i.e. performance_fix to the upstream fork? If so, why delete the name from lazygit's push prompt?
And you want to push it under the same name,
yes
why delete the name from
lazygit's push prompt?
Because you need to delete it in order to move the cursor to the remote, so you change it from origin to fork.
Ah, now I get it.
For the time being, you can press ctrl+a to jump to the beginning of the line and use delete to delete the origin part and replace it with fork.
Or use alt-left-arrow to jump over the branch name, and ctrl-w to delete the remote name and type another one.
These keybindings work in all of lazygit's text fields, it is useful to get used to them. I use them in the commit message panel all the time.
These keybinds don't seem to work on my system: Alt-left-arrow just adds [1;3D to the text for me, and ctrl+w has no effect. Probably my fault (I run a very niche distro, NixOS), but up until now I just figured lazygit didn't bother adding readline or whatever to the textboxes.