mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-05-12 04:45:47 +02:00
When checking out a remote branch by name, ask the user how
The choices are to create a new local branch that tracks the remote, or a detached head.
This commit is contained in:
parent
0360b82aab
commit
e42cbf95ae
4 changed files with 94 additions and 0 deletions
|
@ -436,6 +436,10 @@ func (self *BranchesController) checkoutByName() error {
|
|||
FindSuggestionsFunc: self.c.Helpers().Suggestions.GetRefsSuggestionsFunc(),
|
||||
HandleConfirm: func(response string) error {
|
||||
self.c.LogAction("Checkout branch")
|
||||
_, branchName, found := self.c.Helpers().Refs.ParseRemoteBranchName(response)
|
||||
if found {
|
||||
return self.c.Helpers().Refs.CheckoutRemoteBranch(response, branchName)
|
||||
}
|
||||
return self.c.Helpers().Refs.CheckoutRef(response, types.CheckoutRefOptions{
|
||||
OnRefNotFound: func(ref string) error {
|
||||
return self.c.Confirm(types.ConfirmOpts{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue