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

support cherry picking commits

This commit is contained in:
Jesse Duffield Duffield
2019-02-24 13:51:52 +11:00
parent 1a19b1412d
commit a8858cbd12
7 changed files with 169 additions and 18 deletions

View File

@ -745,3 +745,18 @@ func (c *GitCommand) MoveTodoDown(index int) error {
func (c *GitCommand) Revert(sha string) error {
return c.OSCommand.RunCommand(fmt.Sprintf("git revert %s", sha))
}
// CherryPickShas begins an interactive rebase with the given shas being cherry picked onto HEAD
func (c *GitCommand) CherryPickShas(shas []string) error {
todo := ""
for _, sha := range shas {
todo = "pick " + sha + "\n" + todo
}
cmd, err := c.PrepareInteractiveRebaseCommand("HEAD", todo, false)
if err != nil {
return err
}
return c.OSCommand.RunPreparedCommand(cmd)
}