mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-06-19 00:28:03 +02:00
WIP hard reset
This commit is contained in:
@ -354,3 +354,12 @@ func handleAbortMerge(g *gocui.Gui, v *gocui.View) error {
|
|||||||
refreshStatus(g)
|
refreshStatus(g)
|
||||||
return refreshFiles(g)
|
return refreshFiles(g)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func handleResetHard(g *gocui.Gui, v *gocui.View) error {
|
||||||
|
return createConfirmationPanel(g, v, "Clear file panel", "Are you sure you want `reset --hard HEAD`? You may lose changes", func(g *gocui.Gui, v *gocui.View) error {
|
||||||
|
if err := gitResetHard(); err != nil {
|
||||||
|
createErrorPanel(g, err.Error())
|
||||||
|
}
|
||||||
|
return refreshFiles(g)
|
||||||
|
}, nil)
|
||||||
|
}
|
||||||
|
@ -652,3 +652,7 @@ func getAndMergeFetchedBranches(branches []Branch) []Branch {
|
|||||||
}
|
}
|
||||||
return branches
|
return branches
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func gitResetHard() error {
|
||||||
|
return w.Reset(&git.ResetOptions{Mode: git.HardReset})
|
||||||
|
}
|
||||||
|
@ -39,6 +39,7 @@ func keybindings(g *gocui.Gui) error {
|
|||||||
Binding{ViewName: "files", Key: 'S', Modifier: gocui.ModNone, Handler: handleStashSave},
|
Binding{ViewName: "files", Key: 'S', Modifier: gocui.ModNone, Handler: handleStashSave},
|
||||||
Binding{ViewName: "files", Key: 'a', Modifier: gocui.ModNone, Handler: handleAbortMerge},
|
Binding{ViewName: "files", Key: 'a', Modifier: gocui.ModNone, Handler: handleAbortMerge},
|
||||||
Binding{ViewName: "files", Key: 't', Modifier: gocui.ModNone, Handler: handleAddPatch},
|
Binding{ViewName: "files", Key: 't', Modifier: gocui.ModNone, Handler: handleAddPatch},
|
||||||
|
Binding{ViewName: "files", Key: 'D', Modifier: gocui.ModNone, Handler: handleResetHard},
|
||||||
Binding{ViewName: "main", Key: gocui.KeyArrowUp, Modifier: gocui.ModNone, Handler: handleSelectTop},
|
Binding{ViewName: "main", Key: gocui.KeyArrowUp, Modifier: gocui.ModNone, Handler: handleSelectTop},
|
||||||
Binding{ViewName: "main", Key: gocui.KeyArrowDown, Modifier: gocui.ModNone, Handler: handleSelectBottom},
|
Binding{ViewName: "main", Key: gocui.KeyArrowDown, Modifier: gocui.ModNone, Handler: handleSelectBottom},
|
||||||
Binding{ViewName: "main", Key: gocui.KeyEsc, Modifier: gocui.ModNone, Handler: handleEscapeMerge},
|
Binding{ViewName: "main", Key: gocui.KeyEsc, Modifier: gocui.ModNone, Handler: handleEscapeMerge},
|
||||||
|
Reference in New Issue
Block a user