jesseduffield / lazygit

simple terminal UI for git commands
MIT License
49.91k stars 1.77k forks source link

Add `upstream` remote from GitHub/GitLab #1508

Open abitrolly opened 2 years ago

abitrolly commented 2 years ago

Is your feature request related to a problem? Please describe.

I'm always frustrated when I need to rebase against the parent and have no upsteam remote in my clone.

Describe the solution you'd like

In remotes menu press (a)dd (u)pstream to detect if the repo is a GitLab/GitHub fork and add upstream remote.

Additional context

Current shortcut for adding remote is (n)ew, which is not intuitive, because plain git uses git remote add with no (n) letters. I don't know if renaming or deprecating it is possible.

An alternative is to use (u) shortcut for upstream.

mark2185 commented 2 years ago

I think this would be better as a custom command.

This could also be a good candidate for a pre-set custom command. See https://github.com/jesseduffield/lazygit/wiki/Custom-Commands-Compendium

It's much easier to implement features if a user has created a custom command for it first, because it's clearer what the expected behaviour is

konosubakonoakua commented 2 months ago

https://github.com/konosubakonoakua/.dotfiles/blob/68269e6d38e9299b5a9ec20a98cdb2f5a6ed7634/lazygit/config.yml#L407-L417

abitrolly commented 2 months ago

@konosubakonoakua gud, but doesn't autodetect upstream remote. I do this by parsing PR page https://github.com/yakshaveinc/linux/blob/master/bin/amend-pr.sh