NeogitOrg / neogit

An interactive and powerful Git interface for Neovim, inspired by Magit
MIT License
3.83k stars 228 forks source link

Auto branch naming when fetching a remote branch #1234

Closed tilupe closed 5 months ago

tilupe commented 5 months ago

This is very small inconvenience I experience when checking out remote branches. When I want to checkout a remote branch for reviewing or testing I always use the same branch name as the remote one. Therefore I always have to retype the whole branch name.

I would love to have the option, such that it would automatically copy paste the remote branch name in the "Create branch" input field. So I could still change it but if I don't want to change it I just hit Enter again. There should of course be some exclusions like "main" or "master", or it could make sense to just compare the list of local branch names and if it is not there yet it will use the remote branch name.

Not sure if I could build this by myself and hook somehow into this input field. If so let me know.

Thank you for your amazing plugin. I just love it!

CKolkey commented 5 months ago

The semantics are slightly different, but if you use b then l for local, it will list all remote branches that do not currently have a local branch of the same name. Choosing one will create+checkout a local branch tracking the remote one as it's upstream, so pulling changes is simple. It'll also name it the same as the remote branch, of course.

I know it's not quite the same as checking out the remote branch, but the result is pretty similar.

tilupe commented 5 months ago

Wow thanks for this amazing fast answer! I will try it out immidiately

CKolkey commented 5 months ago

Haha, well, you caught me during work hours, so I was on github for that already 😉