jesseduffield / jesseduffield/lazygit

Respect push.default = "nothing" option

Open
#3,140 0 comments 5 reactions 0 assignees View on GitHub
enhancement
Dominant language
Go
Stars
82.4k
Forks
3k
Avg merge
2d 18h
Merged PRs (30d)
19

Description

**Is your feature request related to a problem? Please describe.**
Lazygit shows an error message on push every time if `push.default` is set to `nothing`.

**Describe the solution you'd like**
I'd like Lazygit to prompt me about which branch I want to push every time I press P.

**Additional context**
I found that calling `git branch --unset-upstream` will cause Lazygit to prompt me once, but after that it stops prompting.

**Describe alternatives you've considered**
- Somehow configure Lazygit to call `git branch --unset-upstream` after every push.
- Don't use the Lazygit push feature. Just quit and push from the command line.

**Custom command**
I couldn't come up with a custom command that does all the nice features of the normal `P` command including suggestions, default autofill, etc. [This one](https://github.com/jesseduffield/lazygit/wiki/Custom-Commands-Compendium#pushing-to-a-specific-remote-branch) is the idea, but it doesn't provide the nice features of normal `P`.

**Suggested solution**
I think a simple fix along the lines of [this function](https://github.com/jesseduffield/lazygit/blob/b86d5bd6886486f4dc48de231c054130a0dac29e/pkg/commands/git_commands/config.go#L85C1-L85C1), except for `push.default == "nothing"` would be the right idea. Then if `push.default` is equal to `nothing`, it should trigger the selection prompt instead of showing the error message.

**Related issue(s)**
#635

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.