diff options
author | Jesse Duffield <jessedduffield@gmail.com> | 2021-06-05 16:39:59 +1000 |
---|---|---|
committer | Jesse Duffield <jessedduffield@gmail.com> | 2021-06-05 22:15:51 +1000 |
commit | fb395bca6eedfc44afb04ad26005a45e7b7dfea9 (patch) | |
tree | 4669caf828ea97afdb9c829820ff53c5731fcca2 /pkg/commands/commits.go | |
parent | f91adf026bfbddc9505d6d84d3fabc80d49c7ca0 (diff) |
support reverting merge commits
Diffstat (limited to 'pkg/commands/commits.go')
-rw-r--r-- | pkg/commands/commits.go | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/pkg/commands/commits.go b/pkg/commands/commits.go index df1a8a2c7..23a2f99a5 100644 --- a/pkg/commands/commits.go +++ b/pkg/commands/commits.go @@ -47,6 +47,10 @@ func (c *GitCommand) GetCommitMessage(commitSha string) (string, error) { return strings.TrimSpace(message), err } +func (c *GitCommand) GetCommitMessageFirstLine(sha string) (string, error) { + return c.RunCommandWithOutput("git show --no-patch --pretty=format:%%s %s", sha) +} + // AmendHead amends HEAD with whatever is staged in your working tree func (c *GitCommand) AmendHead() error { return c.OSCommand.RunCommand(c.AmendHeadCmdStr()) @@ -69,6 +73,10 @@ func (c *GitCommand) Revert(sha string) error { return c.RunCommand("git revert %s", sha) } +func (c *GitCommand) RevertMerge(sha string, parentNumber int) error { + return c.RunCommand("git revert %s -m %d", sha, parentNumber) +} + // CherryPickCommits begins an interactive rebase with the given shas being cherry picked onto HEAD func (c *GitCommand) CherryPickCommits(commits []*models.Commit) error { todo := "" |