@@ -396,16 +396,21 @@ func (self *RefsHelper) MoveCommitsToNewBranch() error {
396396 return err
397397 }
398398
399- withNewBranchNamePrompt := func (baseBranchName string , f func (string , string ) error ) {
399+ withNewBranchNamePrompt := func (baseBranchName string , f func (string , string ) error ) error {
400400 prompt := utils .ResolvePlaceholderString (
401401 self .c .Tr .NewBranchNameBranchOff ,
402402 map [string ]string {
403403 "branchName" : baseBranchName ,
404404 },
405405 )
406+ suggestedBranchName , err := self .getSuggestedBranchName ()
407+ if err != nil {
408+ return err
409+ }
406410
407411 self .c .Prompt (types.PromptOpts {
408- Title : prompt ,
412+ Title : prompt ,
413+ InitialContent : suggestedBranchName ,
409414 HandleConfirm : func (response string ) error {
410415 self .c .LogAction (self .c .Tr .MoveCommitsToNewBranch )
411416 newBranchName := SanitizedBranchName (response )
@@ -414,6 +419,7 @@ func (self *RefsHelper) MoveCommitsToNewBranch() error {
414419 })
415420 },
416421 })
422+ return nil
417423 }
418424
419425 isMainBranch := lo .Contains (self .c .UserConfig ().Git .MainBranches , currentBranch .Name )
@@ -428,8 +434,7 @@ func (self *RefsHelper) MoveCommitsToNewBranch() error {
428434 Title : self .c .Tr .MoveCommitsToNewBranch ,
429435 Prompt : prompt ,
430436 HandleConfirm : func () error {
431- withNewBranchNamePrompt (currentBranch .Name , self .moveCommitsToNewBranchStackedOnCurrentBranch )
432- return nil
437+ return withNewBranchNamePrompt (currentBranch .Name , self .moveCommitsToNewBranchStackedOnCurrentBranch )
433438 },
434439 })
435440 return nil
@@ -449,17 +454,15 @@ func (self *RefsHelper) MoveCommitsToNewBranch() error {
449454 {
450455 Label : fmt .Sprintf (self .c .Tr .MoveCommitsToNewBranchFromBaseItem , shortBaseBranchName ),
451456 OnPress : func () error {
452- withNewBranchNamePrompt (shortBaseBranchName , func (currentBranch string , newBranchName string ) error {
457+ return withNewBranchNamePrompt (shortBaseBranchName , func (currentBranch string , newBranchName string ) error {
453458 return self .moveCommitsToNewBranchOffOfMainBranch (currentBranch , newBranchName , baseBranchRef )
454459 })
455- return nil
456460 },
457461 },
458462 {
459463 Label : fmt .Sprintf (self .c .Tr .MoveCommitsToNewBranchStackedItem , currentBranch .Name ),
460464 OnPress : func () error {
461- withNewBranchNamePrompt (currentBranch .Name , self .moveCommitsToNewBranchStackedOnCurrentBranch )
462- return nil
465+ return withNewBranchNamePrompt (currentBranch .Name , self .moveCommitsToNewBranchStackedOnCurrentBranch )
463466 },
464467 },
465468 },
0 commit comments