mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-06-27 00:51:18 +02:00
added branch delete functionallity
This commit is contained in:
@ -51,6 +51,15 @@ func handleNewBranch(g *gocui.Gui, v *gocui.View) error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func handleDeleteBranch(g *gocui.Gui, v *gocui.View) error {
|
||||||
|
branch := getSelectedBranch(v)
|
||||||
|
if output, err := gitDeleteBranch(branch.Name); err != nil {
|
||||||
|
return createErrorPanel(g, output)
|
||||||
|
}
|
||||||
|
return refreshSidePanels(g)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
func handleMerge(g *gocui.Gui, v *gocui.View) error {
|
func handleMerge(g *gocui.Gui, v *gocui.View) error {
|
||||||
checkedOutBranch := state.Branches[0]
|
checkedOutBranch := state.Branches[0]
|
||||||
selectedBranch := getSelectedBranch(v)
|
selectedBranch := getSelectedBranch(v)
|
||||||
@ -76,6 +85,7 @@ func renderBranchesOptions(g *gocui.Gui) error {
|
|||||||
"m": "merge",
|
"m": "merge",
|
||||||
"c": "checkout by name",
|
"c": "checkout by name",
|
||||||
"n": "new branch",
|
"n": "new branch",
|
||||||
|
"d": "delte branch",
|
||||||
"← → ↑ ↓": "navigate",
|
"← → ↑ ↓": "navigate",
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -29,6 +29,7 @@
|
|||||||
m: merge into currently checked out branch
|
m: merge into currently checked out branch
|
||||||
c: checkout by name
|
c: checkout by name
|
||||||
n: new branch
|
n: new branch
|
||||||
|
d: delete branch
|
||||||
|
|
||||||
## Commits Panel:
|
## Commits Panel:
|
||||||
|
|
||||||
|
@ -459,6 +459,10 @@ func gitNewBranch(name string) (string, error) {
|
|||||||
return runDirectCommand("git checkout -b " + name)
|
return runDirectCommand("git checkout -b " + name)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func gitDeleteBranch(branch string) (string, error) {
|
||||||
|
return runCommand("git branch -d " + branch)
|
||||||
|
}
|
||||||
|
|
||||||
func gitListStash() (string, error) {
|
func gitListStash() (string, error) {
|
||||||
return runDirectCommand("git stash list")
|
return runDirectCommand("git stash list")
|
||||||
}
|
}
|
||||||
|
@ -51,6 +51,7 @@ func keybindings(g *gocui.Gui) error {
|
|||||||
{ViewName: "branches", Key: 'c', Modifier: gocui.ModNone, Handler: handleCheckoutByName},
|
{ViewName: "branches", Key: 'c', Modifier: gocui.ModNone, Handler: handleCheckoutByName},
|
||||||
{ViewName: "branches", Key: 'F', Modifier: gocui.ModNone, Handler: handleForceCheckout},
|
{ViewName: "branches", Key: 'F', Modifier: gocui.ModNone, Handler: handleForceCheckout},
|
||||||
{ViewName: "branches", Key: 'n', Modifier: gocui.ModNone, Handler: handleNewBranch},
|
{ViewName: "branches", Key: 'n', Modifier: gocui.ModNone, Handler: handleNewBranch},
|
||||||
|
{ViewName: "branches", Key: 'd', Modifier: gocui.ModNone, Handler: handleDeleteBranch},
|
||||||
{ViewName: "branches", Key: 'm', Modifier: gocui.ModNone, Handler: handleMerge},
|
{ViewName: "branches", Key: 'm', Modifier: gocui.ModNone, Handler: handleMerge},
|
||||||
{ViewName: "commits", Key: 's', Modifier: gocui.ModNone, Handler: handleCommitSquashDown},
|
{ViewName: "commits", Key: 's', Modifier: gocui.ModNone, Handler: handleCommitSquashDown},
|
||||||
{ViewName: "commits", Key: 'r', Modifier: gocui.ModNone, Handler: handleRenameCommit},
|
{ViewName: "commits", Key: 'r', Modifier: gocui.ModNone, Handler: handleRenameCommit},
|
||||||
|
Reference in New Issue
Block a user