mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-02-01 13:17:53 +02:00
Update README.md
This commit is contained in:
parent
d413d4319f
commit
08174ca848
5
README.md
Normal file
5
README.md
Normal file
@ -0,0 +1,5 @@
|
||||
# lazygit
|
||||
simple terminal UI for git commands
|
||||
|
||||
|
||||
![Gif](https://image.ibb.co/nxyY58/shortone.gif)
|
@ -24,6 +24,16 @@ func handleForceCheckout(g *gocui.Gui, v *gocui.View) error {
|
||||
}, nil)
|
||||
}
|
||||
|
||||
func handleCheckoutByName(g *gocui.Gui, v *gocui.View) error {
|
||||
createPromptPanel(g, v, "Branch Name:", func(g *gocui.Gui, v *gocui.View) error {
|
||||
if output, err := gitCheckout(trimmedContent(v), false); err != nil {
|
||||
return createErrorPanel(g, output)
|
||||
}
|
||||
return refreshSidePanels(g)
|
||||
})
|
||||
return nil
|
||||
}
|
||||
|
||||
func handleNewBranch(g *gocui.Gui, v *gocui.View) error {
|
||||
branch := state.Branches[0]
|
||||
createPromptPanel(g, v, "New Branch Name (Branch is off of "+branch.Name+")", func(g *gocui.Gui, v *gocui.View) error {
|
||||
@ -31,7 +41,7 @@ func handleNewBranch(g *gocui.Gui, v *gocui.View) error {
|
||||
return createErrorPanel(g, output)
|
||||
}
|
||||
refreshSidePanels(g)
|
||||
return handleCommitSelect(g, v)
|
||||
return handleBranchSelect(g, v)
|
||||
})
|
||||
return nil
|
||||
}
|
||||
@ -59,6 +69,7 @@ func renderBranchesOptions(g *gocui.Gui) error {
|
||||
"space": "checkout",
|
||||
"f": "force checkout",
|
||||
"m": "merge",
|
||||
"c": "checkout by name",
|
||||
})
|
||||
}
|
||||
|
||||
|
@ -165,7 +165,14 @@ func getGitBranches() []Branch {
|
||||
return branches
|
||||
}
|
||||
rawString, _ := runDirectCommand(getBranchesCommand)
|
||||
for i, line := range splitLines(rawString) {
|
||||
branchLines := splitLines(rawString)
|
||||
if len(branchLines) == 0 {
|
||||
// sometimes the getBranchesCommand command returns nothing, in which case
|
||||
// we assume you've just init'd or cloned the repo and you've got master
|
||||
// checked out
|
||||
branches = append(branches, branchFromLine(" *\tmaster", 0))
|
||||
}
|
||||
for i, line := range branchLines {
|
||||
branches = append(branches, branchFromLine(line, i))
|
||||
}
|
||||
return branches
|
||||
|
3
gui.go
3
gui.go
@ -146,6 +146,9 @@ func keybindings(g *gocui.Gui) error {
|
||||
if err := g.SetKeybinding("branches", gocui.KeySpace, gocui.ModNone, handleBranchPress); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := g.SetKeybinding("branches", 'c', gocui.ModNone, handleCheckoutByName); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := g.SetKeybinding("branches", 'F', gocui.ModNone, handleForceCheckout); err != nil {
|
||||
return err
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user