Lazygit: Is there a way to checkout a remote branch without typing its full name?

Created on 3 Jul 2020  路  5Comments  路  Source: jesseduffield/lazygit

Topic
I use JIRA+bitbucket, so branches are created on the remote first, with pretty long names

Your thoughts
I'm just trying to figure out if I am missing something obvious - I'd like to see/search/autocomplete a remote branch name and check it out locally.

Thanks!

discussion

Most helpful comment

Solution !

Should have paid more attention to the menu (n) option does what is expected. The workflow is as follows

  • Go to Branches Panel
  • Press ] to navigate to remotes. Press Enter on line with remote branch count to populate remote branches list.
  • Scroll to the remote branch you want to checkout locally and press n. Update the name if needed (I prefer removing origin/ from the name. Press Enter and you have the local branch created

All 5 comments

i don't think that's possible but it would be cool if it exists

+1 for this.

Currently the Remotes tab in the Local Branches area does list the remote branches.

Possible options on Remote branches include

  • space Checkout (but that puts the repo in a detached head state)

there are rebase (r) and merge (M) options but that would perform the actions on the current local checked out branch which is not correct.

Is it possible to create an option (say l) that would create a local branch with the same name and set the upstream to the selected remote branch and then issue a pull to get the latest code locally? On the command line the appropriate action would be git checkout -t origin/<remote-branch-name> assuming remote is called origin

Looks similar to #774 and #833 . All are duplicates asking for the same feature

Solution !

Should have paid more attention to the menu (n) option does what is expected. The workflow is as follows

  • Go to Branches Panel
  • Press ] to navigate to remotes. Press Enter on line with remote branch count to populate remote branches list.
  • Scroll to the remote branch you want to checkout locally and press n. Update the name if needed (I prefer removing origin/ from the name. Press Enter and you have the local branch created

Nice work @hemenkapadia investigating! This has caused some confusion so I've now made the space keybinding do the same thing as the 'n' keybinding (for those who really do want a detached head upon hitting space, I apologise)

Was this page helpful?
0 / 5 - 0 ratings

Related issues

kristijanhusak picture kristijanhusak  路  6Comments

matthiasroos picture matthiasroos  路  3Comments

voigtan picture voigtan  路  4Comments

itsheng picture itsheng  路  7Comments

jesseduffield picture jesseduffield  路  6Comments