1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2025-01-04 03:48:07 +02:00

allow resetting to branch

This commit is contained in:
Jesse Duffield 2020-02-16 09:03:26 +11:00
parent 5b1f60b7eb
commit 73d8064837
3 changed files with 20 additions and 0 deletions

View File

@ -428,3 +428,12 @@ func (gui *Gui) handlePrevBranchesTab(g *gocui.Gui, v *gocui.View) error {
utils.ModuloWithWrap(v.TabIndex-1, len(v.Tabs)),
)
}
func (gui *Gui) handleCreateResetToBranchMenu(g *gocui.Gui, v *gocui.View) error {
branch := gui.getSelectedBranch()
if branch == nil {
return nil
}
return gui.createResetMenu(branch.Name)
}

View File

@ -537,6 +537,14 @@ func (gui *Gui) GetInitialKeybindings() []*Binding {
Handler: gui.handleFastForward,
Description: gui.Tr.SLocalize("FastForward"),
},
{
ViewName: "branches",
Contexts: []string{"local-branches"},
Key: gui.getKey("commits.viewResetOptions"),
Modifier: gocui.ModNone,
Handler: gui.handleCreateResetToBranchMenu,
Description: gui.Tr.SLocalize("resetToThisBranch"),
},
{
ViewName: "branches",
Contexts: []string{"tags"},

View File

@ -942,6 +942,9 @@ func addEnglish(i18nObject *i18n.Bundle) error {
}, &i18n.Message{
ID: "IgnoreTrackedPrompt",
Other: "Are you sure you want to ignore a tracked file?",
}, &i18n.Message{
ID: "resetToThisBranch",
Other: "reset to the HEAD of this branch",
},
)
}