1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2025-06-15 00:15:32 +02:00

Allow to switch branches in Commit View

When the user checks out a commit which has a local branch ref attached
to it, they can select between checking out the branch or checking out
the commit as detached head.
This commit is contained in:
Sebastian Flügge
2024-12-15 18:20:43 +01:00
committed by Sebastian Flügge
parent 03d7bc854e
commit f4c8287143
6 changed files with 145 additions and 27 deletions

View File

@ -280,15 +280,7 @@ func (self *BasicCommitsController) createResetMenu(commit *models.Commit) error
}
func (self *BasicCommitsController) checkout(commit *models.Commit) error {
self.c.Confirm(types.ConfirmOpts{
Title: self.c.Tr.CheckoutCommit,
Prompt: self.c.Tr.SureCheckoutThisCommit,
HandleConfirm: func() error {
self.c.LogAction(self.c.Tr.Actions.CheckoutCommit)
return self.c.Helpers().Refs.CheckoutRef(commit.Hash, types.CheckoutRefOptions{})
},
})
return nil
return self.c.Helpers().Refs.CreateCheckoutMenu(commit)
}
func (self *BasicCommitsController) copyRange(*models.Commit) error {